summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2010-06-15 14:28:38 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2010-06-15 14:28:38 +0100
commitd1e0cee435ef648514626187c99929278357b2e2 (patch)
tree50501c7ef665810aff6088ab8b48eb0061c791c0
parente88aca9032ae06c5c6989f844dc0ed921a0e40e4 (diff)
downloadrabbitmq-server-d1e0cee435ef648514626187c99929278357b2e2.tar.gz
server implements 0.9.1 channel shutdown protocol
-rw-r--r--src/rabbit_reader.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 8e7cd39f..282fd12d 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -371,7 +371,7 @@ close_connection(State = #v1{connection = #connection{
State#v1{connection_state = closed}.
close_channel(Channel, State) ->
- put({channel, Channel}, closing),
+ put({channel, Channel}, {closing, get({channel, Channel})}),
State.
handle_channel_exit(Channel, Reason, State) ->
@@ -483,13 +483,18 @@ handle_frame(Type, Channel, Payload, State) ->
end,
ok = rabbit_framing_channel:process(ChPid, AnalyzedFrame),
State;
- closing ->
+ {closing, {chpid, ChPid}} ->
%% According to the spec, after sending a
%% channel.close we must ignore all frames except
+ %% channel.close and channel.close_ok. In the
+ %% event of a channel.close, we should send back a
%% channel.close_ok.
case AnalyzedFrame of
{method, 'channel.close_ok', _} ->
erase({channel, Channel});
+ {method, 'channel.close', _} ->
+ erase({channel, Channel}),
+ ok = rabbit_framing_channel:process(ChPid, AnalyzedFrame);
_ -> ok
end,
State;