Skip to content

Commit e56e26c

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.
1 parent 55fb43f commit e56e26c

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
@@ -1325,16 +1325,21 @@ is_vhost_alive(VHostPath, User) ->
13251325
end.
13261326

13271327
is_over_node_connection_limit(Addr, Port) ->
1328-
Ref = rabbit_networking:ranch_ref(Addr, Port),
1329-
#{active_connections := ActiveConns} = ranch:info(Ref),
13301328
Limit = rabbit_misc:get_env(rabbit, connection_max, infinity),
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])
1329+
case Limit of
1330+
infinity -> ok;
1331+
N when is_integer(N) ->
1332+
Ref = rabbit_networking:ranch_ref(Addr, Port),
1333+
#{active_connections := ActiveConns} = ranch:info(Ref),
1334+
1335+
case ActiveConns > Limit of
1336+
false -> ok;
1337+
true ->
1338+
rabbit_misc:protocol_error(not_allowed,
1339+
"connection refused: "
1340+
"node connection limit (~tp) is reached",
1341+
[Limit])
1342+
end
13381343
end.
13391344

13401345
is_over_vhost_connection_limit(VHostPath, User) ->

0 commit comments

Comments
 (0)