summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;