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
commit8254b8f5f38495407747813860763ed05883752d (patch)
treef6eac690eb8177b4ba6ae8f19994329c87c3f8c8
parenta05bed30922f63f0ea547148085cd0e19add2a5d (diff)
downloadrabbitmq-server-git-8254b8f5f38495407747813860763ed05883752d.tar.gz
cosmetic
-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 55cf8360b9..9f3dcbd071 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) ->