Skip to content

Commit 7d9eb00

Browse files
Loïc Hoguinmichaelklishin
authored andcommitted
Use addr from #connection directly
(cherry picked from commit 55fb43f)
1 parent e9ef752 commit 7d9eb00

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

deps/rabbit/src/rabbit_reader.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,13 +1212,14 @@ handle_method0(#'connection.open'{virtual_host = VHost},
12121212
State = #v1{connection_state = opening,
12131213
connection = Connection = #connection{
12141214
log_name = ConnName,
1215+
host = Addr,
12151216
port = Port,
12161217
user = User = #user{username = Username},
12171218
protocol = Protocol},
12181219
helper_sup = SupPid,
12191220
sock = Sock,
12201221
throttle = Throttle}) ->
1221-
ok = is_over_node_connection_limit(Port),
1222+
ok = is_over_node_connection_limit(Addr, Port),
12221223
ok = is_over_vhost_connection_limit(VHost, User),
12231224
ok = is_over_user_connection_limit(User),
12241225
ok = rabbit_access_control:check_vhost_access(User, VHost, {socket, Sock}, #{}),
@@ -1319,8 +1320,7 @@ is_vhost_alive(VHostPath, User) ->
13191320
[VHostPath, User#user.username, VHostPath])
13201321
end.
13211322

1322-
is_over_node_connection_limit(Port) ->
1323-
{Addr, _, _} = hd(rabbit_networking:tcp_listener_addresses(Port)),
1323+
is_over_node_connection_limit(Addr, Port) ->
13241324
Ref = rabbit_networking:ranch_ref(Addr, Port),
13251325
#{active_connections := ActiveConns} = ranch:info(Ref),
13261326
Limit = rabbit_misc:get_env(rabbit, connection_max, infinity),

0 commit comments

Comments
 (0)