summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2008-10-01 19:46:17 +0100
committerMatthias Radestock <matthias@lshift.net>2008-10-01 19:46:17 +0100
commit2a0374c97aad540dbf3800a3bdf1329253f9b992 (patch)
treebdc7ed924928c5a87361aded847213bd8600085b /src
parentc2cdd9d49d9173e6e7cd718dc9485e2352cc821e (diff)
parentd0700a23d3ce0b787c0e5333e6f39e99ec663fc8 (diff)
downloadrabbitmq-server-git-2a0374c97aad540dbf3800a3bdf1329253f9b992.tar.gz
merge bug18784
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_reader.erl3
-rw-r--r--src/rabbit_writer.erl11
2 files changed, 11 insertions, 3 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 1d11cbaaea..bfd1ea72ff 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -59,6 +59,7 @@
%% all states, unless specified otherwise:
%% socket error -> *exit*
%% socket close -> *throw*
+%% writer send failure -> *throw*
%% forced termination -> *exit*
%% handshake_timeout -> *throw*
%% pre-init:
@@ -230,6 +231,8 @@ 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}} ->
+ throw(E);
{'EXIT', Pid, Reason} ->
mainloop(Parent, Deb, handle_dependent_exit(Pid, Reason, State));
{terminate_channel, Channel, Ref1} ->
diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl
index eda871ecc7..0f6bca91bc 100644
--- a/src/rabbit_writer.erl
+++ b/src/rabbit_writer.erl
@@ -153,10 +153,15 @@ internal_send_command(Sock, Channel, MethodRecord, Content, FrameMax) ->
%% when these are full. So the fact that we process the result
%% asynchronously does not impact flow control.
internal_send_command_async(Sock, Channel, MethodRecord) ->
- true = erlang:port_command(Sock, assemble_frames(Channel, MethodRecord)),
+ true = port_cmd(Sock, assemble_frames(Channel, MethodRecord)),
ok.
internal_send_command_async(Sock, Channel, MethodRecord, Content, FrameMax) ->
- true = erlang:port_command(Sock, assemble_frames(Channel, MethodRecord,
- Content, FrameMax)),
+ true = port_cmd(Sock, assemble_frames(Channel, MethodRecord,
+ Content, FrameMax)),
ok.
+
+port_cmd(Sock, Data) ->
+ try erlang:port_command(Sock, Data)
+ catch error:Error -> exit({writer, send_failed, Error})
+ end.