summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_channel.erl20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index dc16045245..c5e523ec49 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -1208,12 +1208,15 @@ is_message_persistent(Content) ->
process_routing_result(unroutable, _, MsgSeqNo, Message, State) ->
ok = basic_return(Message, State#ch.writer_pid, no_route),
- send_confirms([MsgSeqNo], State);
+ ok = send_confirm(MsgSeqNo, State#ch.writer_pid),
+ State;
process_routing_result(not_delivered, _, MsgSeqNo, Message, State) ->
ok = basic_return(Message, State#ch.writer_pid, no_consumers),
- send_confirms([MsgSeqNo], State);
+ ok = send_confirm(MsgSeqNo, State#ch.writer_pid),
+ State;
process_routing_result(routed, [], MsgSeqNo, _, State) ->
- send_confirms([MsgSeqNo], State);
+ ok = send_confirm(MsgSeqNo, State#ch.writer_pid),
+ State;
process_routing_result(routed, _, undefined, _, State) ->
State;
process_routing_result(routed, QPids, MsgSeqNo, _, State) ->
@@ -1242,12 +1245,15 @@ send_confirms(Cs, State = #ch{writer_pid = WriterPid, unconfirmed = UC}) ->
WriterPid, #'basic.ack'{delivery_tag = lists:last(Ms),
multiple = true})
end,
- ok = lists:foldl(fun(T, ok) ->
- rabbit_writer:send_command(
- WriterPid, #'basic.ack'{delivery_tag = T})
- end, ok, Ss),
+ [ok = send_confirm(SeqNo, WriterPid) || SeqNo <- Ss],
State.
+send_confirm(undefined, _WriterPid) ->
+ ok;
+send_confirm(SeqNo, WriterPid) ->
+ ok = rabbit_writer:send_command(WriterPid,
+ #'basic.ack'{delivery_tag = SeqNo}).
+
terminate(_State) ->
pg_local:leave(rabbit_channels, self()),
rabbit_event:notify(channel_closed, [{pid, self()}]).