# HG changeset patch # User Tony Garnock-Jones # Date 1209570491 -3600 # Node ID b37faa51170927cf29f547b2e51e71cce14b36ce # Parent 36fad000db328c30dd8461047215124cad420b91 Avoid losing messages when the socket closes abruptly by calling rabbit_channel:shutdown/1, which nicely processes all the pending work before notifying us of channel closure. diff -r 36fad000db32 -r b37faa511709 src/rabbit_stomp.erl --- a/src/rabbit_stomp.erl Wed Apr 30 15:05:33 2008 +0100 +++ b/src/rabbit_stomp.erl Wed Apr 30 16:48:11 2008 +0100 @@ -105,7 +105,13 @@ {tcp, _Sock, Bytes} -> process_received_bytes(Bytes, State); {tcp_closed, _Sock} -> - done; + case State#state.channel of + none -> + done; + ChPid -> + rabbit_channel:shutdown(ChPid), + ?MODULE:mainloop(State) + end; {send_command, Command} -> ?MODULE:mainloop(send_reply(Command, State)); {send_command_and_notify, QPid, TxPid, Method, Content} ->