@@ -1216,13 +1216,14 @@ handle_method0(#'connection.open'{virtual_host = VHost},
1216
1216
State = # v1 {connection_state = opening ,
1217
1217
connection = Connection = # connection {
1218
1218
log_name = ConnName ,
1219
+ host = Addr ,
1219
1220
port = Port ,
1220
1221
user = User = # user {username = Username },
1221
1222
protocol = Protocol },
1222
1223
helper_sup = SupPid ,
1223
1224
sock = Sock ,
1224
1225
throttle = Throttle }) ->
1225
- ok = is_over_node_connection_limit (Port ),
1226
+ ok = is_over_node_connection_limit (Addr , Port ),
1226
1227
ok = is_over_vhost_connection_limit (VHost , User ),
1227
1228
ok = is_over_user_connection_limit (User ),
1228
1229
ok = rabbit_access_control :check_vhost_access (User , VHost , {socket , Sock }, #{}),
@@ -1323,8 +1324,7 @@ is_vhost_alive(VHostPath, User) ->
1323
1324
[VHostPath , User # user .username , VHostPath ])
1324
1325
end .
1325
1326
1326
- is_over_node_connection_limit (Port ) ->
1327
- {Addr , _ , _ } = hd (rabbit_networking :tcp_listener_addresses (Port )),
1327
+ is_over_node_connection_limit (Addr , Port ) ->
1328
1328
Ref = rabbit_networking :ranch_ref (Addr , Port ),
1329
1329
#{active_connections := ActiveConns } = ranch :info (Ref ),
1330
1330
Limit = rabbit_misc :get_env (rabbit , connection_max , infinity ),
0 commit comments