diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2010-11-28 10:56:09 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-11-28 10:56:09 +0000 |
commit | 963d834477df9a4bedaca26b13430b6ee8ef2858 (patch) | |
tree | 13dee9a3570bb39cef28264a5662d28913d66119 | |
parent | 9029a0ad67fd1c9a486b6468f8dffe4812f54454 (diff) | |
download | rabbitmq-server-963d834477df9a4bedaca26b13430b6ee8ef2858.tar.gz |
flesh out writer API for completeness
-rw-r--r-- | src/rabbit_writer.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl index 50bca390..1b4710c6 100644 --- a/src/rabbit_writer.erl +++ b/src/rabbit_writer.erl @@ -34,8 +34,9 @@ -include("rabbit_framing.hrl"). -export([start/5, start_link/5, mainloop/2, mainloop1/2]). --export([send_command/2, send_command/3, send_command_sync/2, - send_command_sync/3, send_command_and_notify/5]). +-export([send_command/2, send_command/3, + send_command_sync/2, send_command_sync/3, + send_command_and_notify/4, send_command_and_notify/5]). -export([internal_send_command/4, internal_send_command/6]). -import(gen_tcp). @@ -66,6 +67,9 @@ -spec(send_command_sync/3 :: (pid(), rabbit_framing:amqp_method_record(), rabbit_types:content()) -> 'ok'). +-spec(send_command_and_notify/4 :: + (pid(), pid(), pid(), rabbit_framing:amqp_method_record()) + -> 'ok'). -spec(send_command_and_notify/5 :: (pid(), pid(), pid(), rabbit_framing:amqp_method_record(), rabbit_types:content()) @@ -130,6 +134,10 @@ handle_message({'$gen_call', From, {send_command_sync, MethodRecord, Content}}, ok = internal_send_command_async(MethodRecord, Content, State), gen_server:reply(From, ok), State; +handle_message({send_command_and_notify, QPid, ChPid, MethodRecord}, State) -> + ok = internal_send_command_async(MethodRecord, State), + rabbit_amqqueue:notify_sent(QPid, ChPid), + State; handle_message({send_command_and_notify, QPid, ChPid, MethodRecord, Content}, State) -> ok = internal_send_command_async(MethodRecord, Content, State), @@ -158,6 +166,10 @@ send_command_sync(W, MethodRecord) -> send_command_sync(W, MethodRecord, Content) -> call(W, {send_command_sync, MethodRecord, Content}). +send_command_and_notify(W, Q, ChPid, MethodRecord) -> + W ! {send_command_and_notify, Q, ChPid, MethodRecord}, + ok. + send_command_and_notify(W, Q, ChPid, MethodRecord, Content) -> W ! {send_command_and_notify, Q, ChPid, MethodRecord, Content}, ok. |