summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2010-08-04 16:16:01 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2010-08-04 16:16:01 +0100
commit8b1ea8d958d56e224a68757105b62c0999b05ce6 (patch)
treedc3e3dff101d290b414eda7a06e889687877edf4 /src
parent98ff3f15f3366fd85e6f63e4797e8f34a11f770e (diff)
downloadrabbitmq-server-git-8b1ea8d958d56e224a68757105b62c0999b05ce6.tar.gz
synchronously delete exclusive queues on server-initiated close
(not just on client-initiated close)
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_reader.erl17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 532572fd00..4b612f2ad8 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -380,8 +380,14 @@ terminate(Explanation, State = #v1{connection_state = running}) ->
terminate(_Explanation, State) ->
{force, State}.
-close_connection(State = #v1{connection = #connection{
+close_connection(State = #v1{queue_collector = Collector,
+ connection = #connection{
timeout_sec = TimeoutSec}}) ->
+ %% The spec says "Exclusive queues may only be accessed by the
+ %% current connection, and are deleted when that connection
+ %% closes." This does not strictly imply synchrony, but in
+ %% practice it seems to be what people assume.
+ rabbit_queue_collector:delete_all(Collector),
%% We terminate the connection after the specified interval, but
%% no later than ?CLOSING_TIMEOUT seconds.
TimeoutMillisec =
@@ -457,18 +463,13 @@ wait_for_channel_termination(N, TimerRef) ->
end.
maybe_close(State = #v1{connection_state = closing,
- queue_collector = Collector,
connection = #connection{protocol = Protocol},
sock = Sock}) ->
case all_channels() of
[] ->
- %% Spec says "Exclusive queues may only be accessed by the current
- %% connection, and are deleted when that connection closes."
- %% This does not strictly imply synchrony, but in practice it seems
- %% to be what people assume.
- rabbit_queue_collector:delete_all(Collector),
+ NewState = close_connection(State),
ok = send_on_channel0(Sock, #'connection.close_ok'{}, Protocol),
- close_connection(State);
+ NewState;
_ -> State
end;
maybe_close(State) ->