summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2008-10-03 13:38:01 +0100
committerMatthias Radestock <matthias@lshift.net>2008-10-03 13:38:01 +0100
commit811734754daf63aefeb3d5a0447c39c0c4b10273 (patch)
treebdc7ed924928c5a87361aded847213bd8600085b
parentf7ec115cd86aee9ff2a8ab079d39612fe6054022 (diff)
downloadrabbitmq-server-bug19487.tar.gz
backout changeset committed on wrong branchbug19487
-rw-r--r--src/rabbit_reader.erl37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 7e68b3ed..bfd1ea72 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -94,18 +94,10 @@
%% terminate_channel timeout -> remove 'closing' mark, *closing*
%% handshake_timeout -> ignore, *closing*
%% heartbeat timeout -> *throw*
-%% channel exit with hard error
-%% -> log error, wait for channels to terminate forcefully, start
-%% terminate_connection timer, send close, *closed*
-%% channel exit with soft error
-%% -> log error, start terminate_channel timer, mark channel as
-%% closing
-%% if last channel to exit then send connection.close_ok,
-%% start terminate_connection timer, *closed*
-%% else *closing*
-%% channel exits normally
-%% -> if last channel to exit then send connection.close_ok,
-%% start terminate_connection timer, *closed*
+%% channel exit ->
+%% if abnormal exit then log error
+%% if last channel to exit then send connection.close_ok, start
+%% terminate_connection timer, *closing*
%% closed:
%% socket close -> *terminate*
%% receive connection.close_ok -> self() ! terminate_connection,
@@ -299,13 +291,24 @@ terminate_channel(Channel, Ref, State) ->
end,
State.
+handle_dependent_exit(Pid, Reason,
+ State = #v1{connection_state = closing}) ->
+ case channel_cleanup(Pid) of
+ undefined -> exit({abnormal_dependent_exit, Pid, Reason});
+ Channel ->
+ case Reason of
+ normal -> ok;
+ _ -> log_channel_error(closing, Channel, Reason)
+ end,
+ maybe_close(State)
+ end;
handle_dependent_exit(Pid, normal, State) ->
channel_cleanup(Pid),
- maybe_close(State);
+ State;
handle_dependent_exit(Pid, Reason, State) ->
case channel_cleanup(Pid) of
undefined -> exit({abnormal_dependent_exit, Pid, Reason});
- Channel -> maybe_close(handle_exception(State, Channel, Reason))
+ Channel -> handle_exception(State, Channel, Reason)
end.
channel_cleanup(Pid) ->
@@ -362,15 +365,13 @@ wait_for_channel_termination(N, TimerRef) ->
exit(channel_termination_timeout)
end.
-maybe_close(State = #v1{connection_state = closing}) ->
+maybe_close(State) ->
case all_channels() of
[] -> ok = send_on_channel0(
State#v1.sock, #'connection.close_ok'{}),
close_connection(State);
_ -> State
- end;
-maybe_close(State) ->
- State.
+ end.
handle_frame(Type, 0, Payload, State = #v1{connection_state = CS})
when CS =:= closing; CS =:= closed ->