diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2011-01-13 02:16:18 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-01-13 02:16:18 +0000 |
| commit | ea9872fc097435ac28622592a445230df4857053 (patch) | |
| tree | 454b420e8473302650dab2e0dbb56fcb30a70dfb /src | |
| parent | 8742edd6816fadd9fb4d5691fdd4ac46a1ad6228 (diff) | |
| download | rabbitmq-server-git-ea9872fc097435ac28622592a445230df4857053.tar.gz | |
bug fix: don't send confirms when MsgSeqNo == undefined
also optimise unrouted message handling further - there is no point in
going through all the logic of determining whether we can send a
multi-ack since we know the MsgSeqNo will be the highest unconfirmed
and it's just a single message we are confirming.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_channel.erl | 20 |
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()}]). |
