diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2013-12-05 14:39:16 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2013-12-05 14:39:16 +0000 |
commit | e0515da4e165e8534469258696646ccfa677493d (patch) | |
tree | 2db5415e3d4e7dd7ea0c0319da0b2133303f1f99 | |
parent | 267acee1d2444e32ab0fd0159974aeec89bfd2c0 (diff) | |
download | rabbitmq-server-e0515da4e165e8534469258696646ccfa677493d.tar.gz |
refactor for clarity
-rw-r--r-- | src/rabbit_reader.erl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index f6693a46..2b33293d 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -612,12 +612,8 @@ create_channel(Channel, State) -> vhost = VHost, capabilities = Capabilities}} = State, N = length(all_channels()), - case ChannelMax /= 0 andalso N + 1 > ChannelMax of - true -> {error, rabbit_misc:amqp_error( - not_allowed, "number of channels opened (~w) has " - "reached the negotiated channel_max (~w)", - [N, ChannelMax], 'none')}; - false -> {ok, _ChSupPid, {ChPid, AState}} = + case ChannelMax == 0 orelse N < ChannelMax of + true -> {ok, _ChSupPid, {ChPid, AState}} = rabbit_channel_sup_sup:start_channel( ChanSupSup, {tcp, Sock, Channel, FrameMax, self(), Name, Protocol, User, VHost, Capabilities, @@ -625,8 +621,12 @@ create_channel(Channel, State) -> MRef = erlang:monitor(process, ChPid), put({ch_pid, ChPid}, {Channel, MRef}), put({channel, Channel}, {ChPid, AState}), - {ok, {ChPid, AState}} - end. + {ok, {ChPid, AState}}; + false -> {error, rabbit_misc:amqp_error( + not_allowed, "number of channels opened (~w) has " + "reached the negotiated channel_max (~w)", + [N, ChannelMax], 'none')} + end. channel_cleanup(ChPid) -> case get({ch_pid, ChPid}) of |