diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2013-01-21 14:58:13 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2013-01-21 14:58:13 +0000 |
| commit | d84207ac26d202a77def6f897bd269173ca42507 (patch) | |
| tree | d6f50a8f06281553c7ac55e0d8636b829d94238e /src | |
| parent | 6400f06e344cf98eb9174e26064513e876616ad6 (diff) | |
| download | rabbitmq-server-git-d84207ac26d202a77def6f897bd269173ca42507.tar.gz | |
Backed out changeset 0ca8cbef9720
accidentally committed on 'stable' instead of bug25360 branch
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_channel.erl | 3 | ||||
| -rw-r--r-- | src/rabbit_writer.erl | 24 |
2 files changed, 8 insertions, 19 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 2b9cffd431..b97af6d8ca 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -280,8 +280,7 @@ handle_cast(ready_for_close, State = #ch{state = closing, ok = rabbit_writer:send_command_sync(WriterPid, #'channel.close_ok'{}), {stop, normal, State}; -handle_cast(terminate, State = #ch{writer_pid = WriterPid}) -> - ok = rabbit_writer:flush(WriterPid), +handle_cast(terminate, State) -> {stop, normal, State}; handle_cast({command, #'basic.consume_ok'{consumer_tag = ConsumerTag} = Msg}, diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl index 059d383914..a7ea3d99b4 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 = []}. |
