diff options
| author | Michael Klishin <michael@rabbitmq.com> | 2013-11-28 14:55:17 +0400 |
|---|---|---|
| committer | Michael Klishin <michael@rabbitmq.com> | 2013-11-28 14:55:17 +0400 |
| commit | 04988dd32e9aeec7342243bf8ee5d114f4384679 (patch) | |
| tree | c0c8d83d2e1436c8755304ab8de236f60046868f | |
| parent | 320126490654e585255f0e4442f280cb89b232d6 (diff) | |
| download | rabbitmq-server-git-04988dd32e9aeec7342243bf8ee5d114f4384679.tar.gz | |
Reject channel.open when the total number of open channel goes above channel_max
| -rw-r--r-- | src/rabbit_reader.erl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 968fb15732..b55fde5a66 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -611,13 +611,14 @@ create_channel(Channel, State) -> user = User, vhost = VHost, capabilities = Capabilities}} = State, - case ChannelMax /= 0 andalso Channel > ChannelMax of + N = length(all_channels()), + case ChannelMax /= 0 andalso N > ChannelMax of true -> %% we cannot use rabbit_misc:protocol_error here because amqp_error is caught %% only for the methods on channel 0. AmqpError = rabbit_misc:amqp_error( - not_allowed, "channel ~w is greater than negotiated channel_max (~w)", - [Channel, ChannelMax], 'channel.open'), + not_allowed, "number of channels opened (~w) is greater than the negotiated channel_max (~w)", + [N, ChannelMax], 'channel.open'), throw({error, AmqpError}); false -> {ok, _ChSupPid, {ChPid, AState}} = |
