Skip to content

Commit 55fb43f

Browse files
Loïc Hoguinmichaelklishin
authored andcommitted
Use addr from #connection directly
1 parent f1c3967 commit 55fb43f

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
@@ -1216,13 +1216,14 @@ handle_method0(#'connection.open'{virtual_host = VHost},
12161216
State = #v1{connection_state = opening,
12171217
connection = Connection = #connection{
12181218
log_name = ConnName,
1219+
host = Addr,
12191220
port = Port,
12201221
user = User = #user{username = Username},
12211222
protocol = Protocol},
12221223
helper_sup = SupPid,
12231224
sock = Sock,
12241225
throttle = Throttle}) ->
1225-
ok = is_over_node_connection_limit(Port),
1226+
ok = is_over_node_connection_limit(Addr, Port),
12261227
ok = is_over_vhost_connection_limit(VHost, User),
12271228
ok = is_over_user_connection_limit(User),
12281229
ok = rabbit_access_control:check_vhost_access(User, VHost, {socket, Sock}, #{}),
@@ -1323,8 +1324,7 @@ is_vhost_alive(VHostPath, User) ->
13231324
[VHostPath, User#user.username, VHostPath])
13241325
end.
13251326

1326-
is_over_node_connection_limit(Port) ->
1327-
{Addr, _, _} = hd(rabbit_networking:tcp_listener_addresses(Port)),
1327+
is_over_node_connection_limit(Addr, Port) ->
13281328
Ref = rabbit_networking:ranch_ref(Addr, Port),
13291329
#{active_connections := ActiveConns} = ranch:info(Ref),
13301330
Limit = rabbit_misc:get_env(rabbit, connection_max, infinity),

0 commit comments

Comments
 (0)