diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2012-12-28 21:15:46 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-12-28 21:15:46 +0000 |
| commit | e0c4599482c38d250269f59e76076d9841e143c8 (patch) | |
| tree | cac40dbd07a993cf283e98d5985eba804ac1c747 /src | |
| parent | 4028000d5fa36e4216cd8db3ad0902e02f126970 (diff) | |
| download | rabbitmq-server-git-e0c4599482c38d250269f59e76076d9841e143c8.tar.gz | |
optimise rabbit_channel:process_routing_result/6
- put most common clause first
- inline record_confirm/3
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_channel.erl | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index a3c8286594..4d3a6f2cea 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -555,11 +555,6 @@ queue_blocked(QPid, State = #ch{blocking = Blocking}) -> State#ch{blocking = Blocking1} end. -record_confirm(undefined, _, State) -> - State; -record_confirm(MsgSeqNo, XName, State) -> - record_confirms([{MsgSeqNo, XName}], State). - record_confirms([], State) -> State; record_confirms(MXs, State = #ch{confirmed = C}) -> @@ -1382,17 +1377,20 @@ deliver_to_queues({Delivery = #delivery{message = Message = #basic_message{ publish, State1), State1. -process_routing_result(unroutable, _, XName, MsgSeqNo, Msg, State) -> - ok = basic_return(Msg, State, no_route), - incr_stats([{exchange_stats, XName, 1}], return_unroutable, State), - record_confirm(MsgSeqNo, XName, State); -process_routing_result(routed, [], XName, MsgSeqNo, _, State) -> - record_confirm(MsgSeqNo, XName, State); process_routing_result(routed, _, _, undefined, _, State) -> State; +process_routing_result(routed, [], XName, MsgSeqNo, _, State) -> + record_confirms([{MsgSeqNo, XName}], State); process_routing_result(routed, QPids, XName, MsgSeqNo, _, State) -> State#ch{unconfirmed = dtree:insert(MsgSeqNo, QPids, XName, - State#ch.unconfirmed)}. + State#ch.unconfirmed)}; +process_routing_result(unroutable, _, XName, MsgSeqNo, Msg, State) -> + ok = basic_return(Msg, State, no_route), + incr_stats([{exchange_stats, XName, 1}], return_unroutable, State), + case MsgSeqNo of + undefined -> State; + _ -> record_confirms([{MsgSeqNo, XName}], State) + end. send_nacks([], State) -> State; |
