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 | dd6f527c8fb75a7ce0294998f29a9afb267baf48 (patch) | |
| tree | cf42f113511b9f4acfcb8a06e9ea326121954f66 | |
| parent | 0b487c1c3301c2ba801e2ef13d88dd533e8ec111 (diff) | |
| download | rabbitmq-server-git-dd6f527c8fb75a7ce0294998f29a9afb267baf48.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 a41171a195..514dd04381 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. |
