diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2013-12-12 12:45:34 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2013-12-12 12:45:34 +0000 |
commit | 9e81a7c1733aea43cdf2fe4adb5ec067e6169eb5 (patch) | |
tree | cf42f113511b9f4acfcb8a06e9ea326121954f66 | |
parent | c9c7d680b2de9a74f3a5f882842b248e9145a4dd (diff) | |
download | rabbitmq-server-9e81a7c1733aea43cdf2fe4adb5ec067e6169eb5.tar.gz |
refactor: take advantage of channel_count to simplify maybe_close
-rw-r--r-- | src/rabbit_reader.erl | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index a41171a1..514dd043 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -536,15 +536,12 @@ wait_for_channel_termination(N, TimerRef, State) -> end. maybe_close(State = #v1{connection_state = closing, - connection = #connection{protocol = Protocol}, - sock = Sock}) -> - case all_channels() of - [] -> - NewState = close_connection(State), - ok = send_on_channel0(Sock, #'connection.close_ok'{}, Protocol), - NewState; - _ -> State - end; + channel_count = 0, + connection = #connection{protocol = Protocol}, + sock = Sock}) -> + NewState = close_connection(State), + ok = send_on_channel0(Sock, #'connection.close_ok'{}, Protocol), + NewState; maybe_close(State) -> State. |