summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2009-01-09 12:24:15 +0000
committerMatthias Radestock <matthias@lshift.net>2009-01-09 12:24:15 +0000
commit19be256662f509babac6f28e630466bbb45d71d7 (patch)
tree26d86b551d573a84c4e07d4cfcd82e8b3539abe0
parent31d439c4900a3d3b7fff369e850b9cf8529ac5c9 (diff)
downloadrabbitmq-server-git-19be256662f509babac6f28e630466bbb45d71d7.tar.gz
fix normal termination case
-rw-r--r--src/rabbit_channel.erl9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 454701eaa4..dae0a96ee8 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -116,10 +116,7 @@ handle_cast({method, Method, Content}, State) ->
{noreply, NewState} ->
{noreply, NewState};
stop ->
- %% TODO: this isn't quite right; it results in queues
- %% being notified twice and rabbit_writer:shutdown being
- %% called twice.
- {stop, normal, State}
+ {stop, normal, State#ch{state = terminating}}
catch
exit:{amqp, Error, Explanation, none} ->
{stop, {amqp, Error, Explanation,
@@ -154,6 +151,9 @@ handle_cast({conserve_memory, Conserve}, State) ->
handle_info({'EXIT', _Pid, Reason}, State) ->
{noreply, Reason, State}.
+terminate(_Reason, #ch{writer_pid = WriterPid, state = terminating}) ->
+ rabbit_writer:shutdown(WriterPid);
+
terminate(Reason, State = #ch{writer_pid = WriterPid}) ->
Res = notify_queues(internal_rollback(State)),
case Reason of
@@ -247,7 +247,6 @@ handle_method(_Method, _, #ch{state = starting}) ->
handle_method(#'channel.close'{}, _, State = #ch{writer_pid = WriterPid}) ->
ok = notify_queues(internal_rollback(State)),
ok = rabbit_writer:send_command(WriterPid, #'channel.close_ok'{}),
- ok = rabbit_writer:shutdown(WriterPid),
stop;
handle_method(#'access.request'{},_, State) ->