diff options
author | Michael Klishin <michael@rabbitmq.com> | 2013-07-23 15:20:55 +0400 |
---|---|---|
committer | Michael Klishin <michael@rabbitmq.com> | 2013-07-23 15:20:55 +0400 |
commit | b347d853f67574a192a071488bda46a241b8f84b (patch) | |
tree | 2d00c47998822c2ffd2ead512347d3f7d94f4271 | |
parent | 07434c2cc85974ac419ccfa848792951a807806d (diff) | |
download | rabbitmq-server-b347d853f67574a192a071488bda46a241b8f84b.tar.gz |
Rename #throttle.conserve_resources to .alarmed_by
-rw-r--r-- | src/rabbit_reader.erl | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 7288d59a..0e88a65a 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -45,7 +45,7 @@ client_properties, capabilities, auth_mechanism, auth_state}). --record(throttle, {conserve_resources, last_blocked_by, last_blocked_at, +-record(throttle, {alarmed_by, last_blocked_by, last_blocked_at, blocked_sent}). -define(STATISTICS_KEYS, [pid, recv_oct, recv_cnt, send_oct, send_cnt, @@ -248,10 +248,10 @@ start_connection(Parent, ConnSupPid, Collector, StartHeartbeatFun, Deb, buf = [], buf_len = 0, throttle = #throttle{ - conserve_resources = [], - last_blocked_by = none, - last_blocked_at = never, - blocked_sent = false}}, + alarmed_by = [], + last_blocked_by = none, + last_blocked_at = never, + blocked_sent = false}}, try run({?MODULE, recvloop, [Deb, switch_callback(rabbit_event:init_stats_timer( @@ -326,12 +326,12 @@ mainloop(Deb, State = #v1{sock = Sock, buf = Buf, buf_len = BufLen}) -> handle_other({conserve_resources, Source, Conserve}, State = #v1{throttle = Throttle = - #throttle{conserve_resources = CR}}) -> + #throttle{alarmed_by = CR}}) -> CR1 = case Conserve of true -> lists:usort([Source | CR]); false -> CR -- [Source] end, - Throttle1 = Throttle#throttle{conserve_resources = CR1}, + Throttle1 = Throttle#throttle{alarmed_by = CR1}, control_throttle(State#v1{throttle = Throttle1}); handle_other({channel_closing, ChPid}, State) -> ok = rabbit_channel:ready_for_close(ChPid), @@ -417,7 +417,7 @@ terminate(_Explanation, State) -> {force, State}. control_throttle(State = #v1{connection_state = CS, throttle = Throttle}) -> - IsThrottled = ((Throttle#throttle.conserve_resources =/= []) orelse + IsThrottled = ((Throttle#throttle.alarmed_by =/= []) orelse credit_flow:blocked()), case {CS, IsThrottled} of {running, true} -> State#v1{connection_state = blocking}; @@ -444,9 +444,9 @@ maybe_block(State = #v1{connection_state = blocking, maybe_block(State) -> State. -maybe_send_blocked(#v1{throttle = #throttle{conserve_resources = []}}) -> +maybe_send_blocked(#v1{throttle = #throttle{alarmed_by = []}}) -> false; -maybe_send_blocked(#v1{throttle = #throttle{conserve_resources = CR}, +maybe_send_blocked(#v1{throttle = #throttle{alarmed_by = CR}, connection = #connection{ protocol = Protocol, capabilities = Capabilities}, @@ -468,7 +468,7 @@ maybe_send_unblocked(#v1{connection = #connection{protocol = Protocol}, sock = Sock}) -> ok = send_on_channel0(Sock, #'connection.unblocked'{}, Protocol). -update_last_blocked_by(Throttle = #throttle{conserve_resources = []}) -> +update_last_blocked_by(Throttle = #throttle{alarmed_by = []}) -> Throttle#throttle{last_blocked_by = flow}; update_last_blocked_by(Throttle) -> Throttle#throttle{last_blocked_by = resource}. @@ -883,7 +883,7 @@ handle_method0(#'connection.open'{virtual_host = VHostPath}, NewConnection = Connection#connection{vhost = VHostPath}, ok = send_on_channel0(Sock, #'connection.open_ok'{}, Protocol), Conserve = rabbit_alarm:register(self(), {?MODULE, conserve_resources, []}), - Throttle1 = Throttle#throttle{conserve_resources = Conserve}, + Throttle1 = Throttle#throttle{alarmed_by = Conserve}, {ok, ChannelSupSupPid} = supervisor2:start_child( ConnSupPid, |