summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2013-12-12 12:01:15 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2013-12-12 12:01:15 +0000
commit8554a9a46502a68345c4da8e5e9df2817b03e7c6 (patch)
tree479f4a0159db28c15226f09251516c5b6b49eae6
parent158b456381a0d1874cf8bb47fac89474f54c7bc0 (diff)
downloadrabbitmq-server-8554a9a46502a68345c4da8e5e9df2817b03e7c6.tar.gz
correct handling of channel_cleanup return value
plus some cosmetics in the area
-rw-r--r--src/rabbit_reader.erl23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index d4ae9655..bece5194 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -520,17 +520,18 @@ wait_for_channel_termination(0, TimerRef, _State) ->
wait_for_channel_termination(N, TimerRef, State) ->
receive
{'DOWN', _MRef, process, ChPid, Reason} ->
- case {channel_cleanup(ChPid, State), termination_kind(Reason)} of
- {undefined, _} ->
- exit({abnormal_dependent_exit, ChPid, Reason});
- {_Channel, controlled} ->
- wait_for_channel_termination(N-1, TimerRef, State);
- {Channel, uncontrolled} ->
- log(error,
- "AMQP connection ~p, channel ~p - "
- "error while terminating:~n~p~n",
- [self(), Channel, Reason]),
- wait_for_channel_termination(N-1, TimerRef, State)
+ {Channel, State1} = channel_cleanup(ChPid, State),
+ case {Channel, termination_kind(Reason)} of
+ {undefined, _} -> exit({abnormal_dependent_exit,
+ ChPid, Reason});
+ {_, controlled} -> wait_for_channel_termination(
+ N-1, TimerRef, State1);
+ {_, uncontrolled} -> log(error,
+ "AMQP connection ~p, channel ~p - "
+ "error while terminating:~n~p~n",
+ [self(), Channel, Reason]),
+ wait_for_channel_termination(
+ N-1, TimerRef, State1)
end;
cancel_wait ->
exit(channel_termination_timeout)