@@ -90,7 +90,8 @@ can_send(undefined, _QPid, _AckRequired) ->
9090can_send (LimiterPid , QPid , AckRequired ) ->
9191 rabbit_misc :with_exit_handler (
9292 fun () -> true end ,
93- fun () -> gen_server2 :call (LimiterPid , {can_send , QPid , AckRequired }, infinity ) end ).
93+ fun () -> gen_server2 :call (LimiterPid , {can_send , QPid , AckRequired },
94+ infinity ) end ).
9495
9596% % Let the limiter know that the channel has received some acks from a
9697% % consumer
@@ -110,13 +111,13 @@ unregister(LimiterPid, QPid) -> gen_server2:cast(LimiterPid, {unregister, QPid})
110111init ([ChPid ]) ->
111112 {ok , # lim {ch_pid = ChPid } }.
112113
113- handle_call ({can_send , QPid , AckRequired }, _From , State = # lim {volume = Volume }) ->
114- Volume1 = if AckRequired -> Volume + 1 ;
115- true -> Volume
116- end ,
114+ handle_call ({can_send , QPid , AckRequired }, _From ,
115+ State = # lim {volume = Volume }) ->
117116 case limit_reached (State ) of
118117 true -> {reply , false , limit_queue (QPid , State )};
119- false -> {reply , true , State # lim {volume = Volume1 }}
118+ false -> {reply , true , State # lim {volume = if AckRequired -> Volume + 1 ;
119+ true -> Volume
120+ end }}
120121 end .
121122
122123handle_cast (shutdown , State ) ->
0 commit comments