summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_writer.erl33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl
index f8d6cbd5..fc1d96cf 100644
--- a/src/rabbit_writer.erl
+++ b/src/rabbit_writer.erl
@@ -127,6 +127,21 @@ handle_message({send_command, MethodRecord, Content},
ok = internal_send_command_async(Sock, Channel, MethodRecord,
Content, FrameMax, Protocol),
State;
+handle_message({'$gen_call', From, {send_command_sync, MethodRecord}},
+ State = #wstate{sock = Sock, channel = Channel,
+ protocol = Protocol}) ->
+ ok = internal_send_command_async(Sock, Channel, MethodRecord, Protocol),
+ gen_server:reply(From, ok),
+ State;
+handle_message({'$gen_call', From, {send_command_sync, MethodRecord, Content}},
+ State = #wstate{sock = Sock,
+ channel = Channel,
+ frame_max = FrameMax,
+ protocol = Protocol}) ->
+ ok = internal_send_command_async(Sock, Channel, MethodRecord,
+ Content, FrameMax, Protocol),
+ gen_server:reply(From, ok),
+ State;
handle_message({send_command_and_notify, QPid, ChPid, MethodRecord, Content},
State = #wstate{sock = Sock,
channel = Channel,
@@ -140,27 +155,9 @@ handle_message({inet_reply, _, ok}, State) ->
State;
handle_message({inet_reply, _, Status}, _State) ->
exit({writer, send_failed, Status});
-handle_message({'$gen_call', From, Msg}, State) ->
- case handle_call(From, Msg, State) of
- {reply, Reply, State2} -> gen_server:reply(From, Reply), State2;
- {noreply, State2} -> State2;
- {stop, Reason, _State2} -> exit(Reason)
- end;
handle_message(Message, _State) ->
exit({writer, message_not_understood, Message}).
-handle_call({send_command_async, MethodRecord}, _From,
- State = #wstate{sock = Sock, channel = Channel,
- protocol = Protocol}) ->
- ok = internal_send_command_async(Sock, Channel, MethodRecord, Protocol),
- {reply, ok, State};
-handle_call({send_command_async, MethodRecord, Content}, _From,
- State = #wstate{sock = Sock, channel = Channel,
- frame_max = FrameMax, protocol = Protocol}) ->
- ok = internal_send_command_async(Sock, Channel, MethodRecord,
- Content, FrameMax, Protocol),
- {reply, ok, State}.
-
%---------------------------------------------------------------------------
send_command(W, MethodRecord) ->