summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2009-09-15 10:00:37 +0100
committerMatthias Radestock <matthias@lshift.net>2009-09-15 10:00:37 +0100
commit1b53ef0669dda7089bf0cade65e37f11c2763eb5 (patch)
treebe9bf11b2a5109e594507f9dbf36b8c3347573f5
parent6e4f32ff969b274cb64a5ef0a2fd8aeca5f7310e (diff)
parent1a7aaf37b3868d9145f3460e21232d1209a3a790 (diff)
downloadrabbitmq-server-1b53ef0669dda7089bf0cade65e37f11c2763eb5.tar.gz
merge bug21529 into default
-rw-r--r--src/rabbit_channel.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 16b7c938..1285064f 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -126,7 +126,7 @@ handle_cast({method, Method, Content}, State) ->
{stop, normal, State#ch{state = terminating}}
catch
exit:{amqp, Error, Explanation, none} ->
- ok = notify_queues(internal_rollback(State)),
+ ok = rollback_and_notify(State),
Reason = {amqp, Error, Explanation,
rabbit_misc:method_record_type(Method)},
State#ch.reader_pid ! {channel_exit, State#ch.channel, Reason},
@@ -175,7 +175,7 @@ terminate(_Reason, #ch{writer_pid = WriterPid, limiter_pid = LimiterPid,
terminate(Reason, State = #ch{writer_pid = WriterPid,
limiter_pid = LimiterPid}) ->
- Res = notify_queues(internal_rollback(State)),
+ Res = rollback_and_notify(State),
case Reason of
normal -> ok = Res;
_ -> ok
@@ -297,7 +297,7 @@ handle_method(_Method, _, #ch{state = starting}) ->
rabbit_misc:protocol_error(channel_error, "expected 'channel.open'", []);
handle_method(#'channel.close'{}, _, State = #ch{writer_pid = WriterPid}) ->
- ok = notify_queues(internal_rollback(State)),
+ ok = rollback_and_notify(State),
ok = rabbit_writer:send_command(WriterPid, #'channel.close_ok'{}),
stop;
@@ -872,6 +872,11 @@ internal_rollback(State = #ch{transaction_id = TxnKey,
internal_error, "rollback failed: ~w", [Errors])
end.
+rollback_and_notify(State = #ch{transaction_id = none}) ->
+ notify_queues(State);
+rollback_and_notify(State) ->
+ notify_queues(internal_rollback(State)).
+
fold_per_queue(F, Acc0, UAQ) ->
D = lists:foldl(
fun ({_DTag, _CTag,