summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2009-09-07 17:02:45 +0100
committerMatthias Radestock <matthias@lshift.net>2009-09-07 17:02:45 +0100
commit9dc88ef9363f55f11f5ada3b9a4918b2c36cabaa (patch)
tree2c579c6297248169e26a2c1bb22025bf4b7eff72
parent672c802fbdc3127e4152c8698881bc88df6aac0c (diff)
downloadrabbitmq-server-9dc88ef9363f55f11f5ada3b9a4918b2c36cabaa.tar.gz
don't attempt rollbacks on non-tx channels
-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..1c08ad6d 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(internal_rollback(State));
+rollback_and_notify(State) ->
+ notify_queues(State).
+
fold_per_queue(F, Acc0, UAQ) ->
D = lists:foldl(
fun ({_DTag, _CTag,