summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2010-06-21 13:27:42 +0100
committerSimon MacMullen <simon@rabbitmq.com>2010-06-21 13:27:42 +0100
commit4acc3d91479106f0c7158705023f8b0f0bd884ac (patch)
treedb0625180214691de3d1fcdf069f305da86f7d10 /src
parent368aacd1b838775a2e8170fdfb8480b6b9d84fcd (diff)
parent12afce7089cdbd60a3ae52d7fcc9617019bafe85 (diff)
downloadrabbitmq-server-git-4acc3d91479106f0c7158705023f8b0f0bd884ac.tar.gz
Merge bug 21849
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_reader.erl10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 8e7cd39f8a..c6b7f19fab 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -105,6 +105,8 @@
%% heartbeat timeout -> *throw*
%% closing:
%% socket close -> *terminate*
+%% receive connection.close -> send connection.close_ok,
+%% *closing*
%% receive frame -> ignore, *closing*
%% handshake_timeout -> ignore, *closing*
%% heartbeat timeout -> *throw*
@@ -121,6 +123,8 @@
%% start terminate_connection timer, *closed*
%% closed:
%% socket close -> *terminate*
+%% receive connection.close -> send connection.close_ok,
+%% *closed*
%% receive connection.close_ok -> self() ! terminate_connection,
%% *closed*
%% receive frame -> ignore, *closed*
@@ -651,6 +655,12 @@ handle_method0(#'connection.close'{},
State = #v1{connection_state = running}) ->
lists:foreach(fun rabbit_framing_channel:shutdown/1, all_channels()),
maybe_close(State#v1{connection_state = closing});
+handle_method0(#'connection.close'{}, State = #v1{connection_state = CS})
+ when CS =:= closing; CS =:= closed ->
+ %% We're already closed or closing, so we don't need to cleanup
+ %% anything.
+ ok = send_on_channel0(State#v1.sock, #'connection.close_ok'{}),
+ State;
handle_method0(#'connection.close_ok'{},
State = #v1{connection_state = closed}) ->
self() ! terminate_connection,