diff options
| author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-08-16 11:31:48 +0100 |
|---|---|---|
| committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-08-16 11:31:48 +0100 |
| commit | 7f0bc2cddfcd046fecde2f93a5f1ddd4ab348ae3 (patch) | |
| tree | 7c6b40d7dac3a96d1e4d20ec0d180d9e1c6751d6 /src | |
| parent | 02ee72652a15b2d8d075c58ae0a29408fd050987 (diff) | |
| download | rabbitmq-server-git-7f0bc2cddfcd046fecde2f93a5f1ddd4ab348ae3.tar.gz | |
refactoring
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_channel.erl | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 0571e45449..f6e72814c9 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -434,7 +434,6 @@ send_or_enqueue_ack(MsgSeqNo, rabbit_log:info("handling confirm in single mode (#~p)~n", [MsgSeqNo]), do_if_not_dup(MsgSeqNo, State, fun(MSN, S = #ch{writer_pid = WriterPid}) -> - rabbit_log:info("confirm #~p is not a dup!~n", [MSN]), ok = rabbit_writer:send_command( WriterPid, #'basic.ack'{delivery_tag = MSN}), S @@ -443,7 +442,6 @@ send_or_enqueue_ack(MsgSeqNo, State = #ch{confirm = #confirm{multiple = true}}) rabbit_log:info("handling confirm in multiple mode (#~p)~n", [MsgSeqNo]), do_if_not_dup(MsgSeqNo, State, fun(MSN, S) -> - rabbit_log:info("confirm #~p is not a dup!~n", [MSN]), State1 = #ch{confirm = C = #confirm{held_acks = As}} = start_ack_timer(S), @@ -500,23 +498,24 @@ handle_method(#'basic.publish'{exchange = ExchangeNameBin, false -> {undefined, State}; true -> - Count = State#ch.confirm#confirm.count, - Confirm = State#ch.confirm, - Confirm1 = Confirm#confirm{ - need_acking = gb_sets:add(Count, - Confirm#confirm.need_acking)}, - - {CountOrUndefined, NewState} = + Count = Confirm#confirm.count, + % Add the current message to the need_acking list + State01 = State#ch{confirm = Confirm#confirm{ + need_acking = gb_sets:add(Count, + Confirm#confirm.need_acking)}}, + % Ack transient messages now + {CountOrUndefined, State02} = case IsPersistent of - true -> {Count, State#ch{confirm = Confirm1}}; + true -> {Count, State01}; false -> {undefined, send_or_enqueue_ack( - Count, State#ch{confirm = Confirm1})} + Count, State01)} end, - Confirm2 = NewState#ch.confirm, + % Increase the PubAck counter + Confirm02 = State02#ch.confirm, {CountOrUndefined, - NewState#ch{confirm = Confirm2#confirm{count = Count+1}}} + State02#ch{confirm = Confirm02#confirm{count = Count+1}}} end, Message = #basic_message{exchange_name = ExchangeName, routing_key = RoutingKey, |
