Skip to content

Commit 9507fcb

Browse files
Connection limit: don't do anything if the limit is not configured
In rabbit_reader:is_over_connection_limit/2. References #7753, #7787, #7593. (cherry picked from commit e56e26c)
1 parent 7d9eb00 commit 9507fcb

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

deps/rabbit/src/rabbit_reader.erl

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,16 +1321,21 @@ is_vhost_alive(VHostPath, User) ->
13211321
end.
13221322

13231323
is_over_node_connection_limit(Addr, Port) ->
1324-
Ref = rabbit_networking:ranch_ref(Addr, Port),
1325-
#{active_connections := ActiveConns} = ranch:info(Ref),
13261324
Limit = rabbit_misc:get_env(rabbit, connection_max, infinity),
1327-
case ActiveConns > Limit of
1328-
false -> ok;
1329-
true ->
1330-
rabbit_misc:protocol_error(not_allowed,
1331-
"connection refused: "
1332-
"node connection limit (~tp) is reached",
1333-
[Limit])
1325+
case Limit of
1326+
infinity -> ok;
1327+
N when is_integer(N) ->
1328+
Ref = rabbit_networking:ranch_ref(Addr, Port),
1329+
#{active_connections := ActiveConns} = ranch:info(Ref),
1330+
1331+
case ActiveConns > Limit of
1332+
false -> ok;
1333+
true ->
1334+
rabbit_misc:protocol_error(not_allowed,
1335+
"connection refused: "
1336+
"node connection limit (~tp) is reached",
1337+
[Limit])
1338+
end
13341339
end.
13351340

13361341
is_over_vhost_connection_limit(VHostPath, User) ->

0 commit comments

Comments
 (0)