diff options
author | Matthias Radestock <matthias@lshift.net> | 2009-01-09 12:24:15 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@lshift.net> | 2009-01-09 12:24:15 +0000 |
commit | 216a2b42ddbd8e05d5a81336e8edaa190ea94c77 (patch) | |
tree | 26d86b551d573a84c4e07d4cfcd82e8b3539abe0 /src | |
parent | 7b62fa15b69499ed5b67c39f51126521d3e20879 (diff) | |
download | rabbitmq-server-216a2b42ddbd8e05d5a81336e8edaa190ea94c77.tar.gz |
fix normal termination case
Diffstat (limited to 'src')
-rw-r--r-- | src/rabbit_channel.erl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 454701ea..dae0a96e 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) -> |