summaryrefslogtreecommitdiff
path: root/src/rabbit_writer.erl
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2013-01-21 14:58:13 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2013-01-21 14:58:13 +0000
commitad58ded86094cd49a4333fdd5d79f49feb591d55 (patch)
treed6f50a8f06281553c7ac55e0d8636b829d94238e /src/rabbit_writer.erl
parent62c4b3d9963ea78a5c36a3981958c8e6988f0756 (diff)
downloadrabbitmq-server-ad58ded86094cd49a4333fdd5d79f49feb591d55.tar.gz
Backed out changeset 0ca8cbef9720
accidentally committed on 'stable' instead of bug25360 branch
Diffstat (limited to 'src/rabbit_writer.erl')
-rw-r--r--src/rabbit_writer.erl24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl
index 059d3839..a7ea3d99 100644
--- a/src/rabbit_writer.erl
+++ b/src/rabbit_writer.erl
@@ -21,8 +21,7 @@
-export([start/5, start_link/5, start/6, start_link/6]).
-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,
- flush/1]).
+ send_command_and_notify/4, send_command_and_notify/5]).
-export([internal_send_command/4, internal_send_command/6]).
%% internal
@@ -70,7 +69,6 @@
(pid(), pid(), pid(), rabbit_framing:amqp_method_record(),
rabbit_types:content())
-> 'ok').
--spec(flush/1 :: (pid()) -> 'ok').
-spec(internal_send_command/4 ::
(rabbit_net:socket(), rabbit_channel:channel_number(),
rabbit_framing:amqp_method_record(), rabbit_types:protocol())
@@ -132,7 +130,7 @@ mainloop1(State) ->
receive
Message -> ?MODULE:mainloop1(handle_message(Message, State))
after 0 ->
- ?MODULE:mainloop1(internal_flush(State))
+ ?MODULE:mainloop1(flush(State))
end.
handle_message({send_command, MethodRecord}, State) ->
@@ -140,18 +138,12 @@ handle_message({send_command, MethodRecord}, State) ->
handle_message({send_command, MethodRecord, Content}, State) ->
internal_send_command_async(MethodRecord, Content, State);
handle_message({'$gen_call', From, {send_command_sync, MethodRecord}}, State) ->
- State1 = internal_flush(
- internal_send_command_async(MethodRecord, State)),
+ State1 = flush(internal_send_command_async(MethodRecord, State)),
gen_server:reply(From, ok),
State1;
handle_message({'$gen_call', From, {send_command_sync, MethodRecord, Content}},
State) ->
- State1 = internal_flush(
- internal_send_command_async(MethodRecord, Content, State)),
- gen_server:reply(From, ok),
- State1;
-handle_message({'$gen_call', From, flush}, State) ->
- State1 = internal_flush(State),
+ State1 = flush(internal_send_command_async(MethodRecord, Content, State)),
gen_server:reply(From, ok),
State1;
handle_message({send_command_and_notify, QPid, ChPid, MethodRecord}, State) ->
@@ -200,8 +192,6 @@ send_command_and_notify(W, Q, ChPid, MethodRecord, Content) ->
W ! {send_command_and_notify, Q, ChPid, MethodRecord, Content},
ok.
-flush(W) -> call(W, flush).
-
%%---------------------------------------------------------------------------
call(Pid, Msg) ->
@@ -261,13 +251,13 @@ internal_send_command_async(MethodRecord, Content,
maybe_flush(State = #wstate{pending = Pending}) ->
case iolist_size(Pending) >= ?FLUSH_THRESHOLD of
- true -> internal_flush(State);
+ true -> flush(State);
false -> State
end.
-internal_flush(State = #wstate{pending = []}) ->
+flush(State = #wstate{pending = []}) ->
State;
-internal_flush(State = #wstate{sock = Sock, pending = Pending}) ->
+flush(State = #wstate{sock = Sock, pending = Pending}) ->
ok = port_cmd(Sock, lists:reverse(Pending)),
State#wstate{pending = []}.