summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2009-06-10 06:42:10 +0100
committerMatthias Radestock <matthias@lshift.net>2009-06-10 06:42:10 +0100
commit0f89004dd0b386db1b2444abd47c4946d05e3e33 (patch)
treef6eac690eb8177b4ba6ae8f19994329c87c3f8c8
parent522f5b682f01134e2f9d2e4a27f037527bfae3dd (diff)
downloadrabbitmq-server-bug20940.tar.gz
cosmeticbug20940
-rw-r--r--src/rabbit_limiter.erl13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl
index 55cf8360..9f3dcbd0 100644
--- a/src/rabbit_limiter.erl
+++ b/src/rabbit_limiter.erl
@@ -90,7 +90,8 @@ can_send(undefined, _QPid, _AckRequired) ->
can_send(LimiterPid, QPid, AckRequired) ->
rabbit_misc:with_exit_handler(
fun () -> true end,
- fun () -> gen_server2:call(LimiterPid, {can_send, QPid, AckRequired}, infinity) end).
+ fun () -> gen_server2:call(LimiterPid, {can_send, QPid, AckRequired},
+ infinity) end).
%% Let the limiter know that the channel has received some acks from a
%% consumer
@@ -110,13 +111,13 @@ unregister(LimiterPid, QPid) -> gen_server2:cast(LimiterPid, {unregister, QPid})
init([ChPid]) ->
{ok, #lim{ch_pid = ChPid} }.
-handle_call({can_send, QPid, AckRequired}, _From, State = #lim{volume = Volume}) ->
- Volume1 = if AckRequired -> Volume + 1;
- true -> Volume
- end,
+handle_call({can_send, QPid, AckRequired}, _From,
+ State = #lim{volume = Volume}) ->
case limit_reached(State) of
true -> {reply, false, limit_queue(QPid, State)};
- false -> {reply, true, State#lim{volume = Volume1}}
+ false -> {reply, true, State#lim{volume = if AckRequired -> Volume + 1;
+ true -> Volume
+ end}}
end.
handle_cast(shutdown, State) ->