diff options
author | Matthew Sackman <matthew@lshift.net> | 2009-08-10 15:43:35 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@lshift.net> | 2009-08-10 15:43:35 +0100 |
commit | 7b15f312db19a33b65937480e7b6b9beab47ff59 (patch) | |
tree | cc826722c45609fc2703124e8e6c3975c107f456 | |
parent | ea67ca82ef894396adc69ee6f7bdb7fa0d6f2e92 (diff) | |
download | rabbitmq-server-7b15f312db19a33b65937480e7b6b9beab47ff59.tar.gz |
Channel now catches the exit of the writer and signals the reader explicitly. It then exits normally, thus avoiding the pointless and expensive formatting of its error message
-rw-r--r-- | src/rabbit_channel.erl | 4 | ||||
-rw-r--r-- | src/rabbit_reader.erl | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 58b94234..c30024a6 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -157,6 +157,10 @@ handle_cast({conserve_memory, Conserve}, State) -> State#ch.writer_pid, #'channel.flow'{active = not(Conserve)}), noreply(State). +handle_info({'EXIT', WriterPid, Reason = {writer, send_failed, _Error}}, + State = #ch{writer_pid = WriterPid}) -> + State#ch.reader_pid ! {channel_unexpected_exit, Reason}, + {stop, normal, State}; handle_info({'EXIT', _Pid, Reason}, State) -> {stop, Reason, State}; diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 426b99eb..91732e0d 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -286,7 +286,7 @@ mainloop(Parent, Deb, State = #v1{sock= Sock, recv_ref = Ref}) -> %% since this termination is initiated by our parent it is %% probably more important to exit quickly. exit(Reason); - {'EXIT', _Pid, E = {writer, send_failed, _Error}} -> + {channel_unexpected_exit, E = {writer, send_failed, _Error}} -> throw(E); {channel_exit, Channel, Reason} -> mainloop(Parent, Deb, handle_channel_exit(Channel, Reason, State)); |