NetworkServer.IsConnectionAllowed: log address too

This commit is contained in:
mischa 2024-10-15 12:45:27 +02:00
parent 86302503da
commit ef5fc77728

View File

@ -658,7 +658,7 @@ static void OnTransportConnected(int connectionId)
static void OnTransportConnectedWithAddress(int connectionId, string clientAddress)
{
if (IsConnectionAllowed(connectionId))
if (IsConnectionAllowed(connectionId, clientAddress))
{
// create a connection
NetworkConnectionToClient conn = new NetworkConnectionToClient(connectionId, clientAddress);
@ -671,7 +671,7 @@ static void OnTransportConnectedWithAddress(int connectionId, string clientAddre
}
}
static bool IsConnectionAllowed(int connectionId)
static bool IsConnectionAllowed(int connectionId, string address)
{
// connectionId needs to be != 0 because 0 is reserved for local player
// note that some transports like kcp generate connectionId by
@ -685,7 +685,7 @@ static bool IsConnectionAllowed(int connectionId)
// connectionId not in use yet?
if (connections.ContainsKey(connectionId))
{
Debug.LogError($"Server connectionId {connectionId} already in use...client will be kicked");
Debug.LogError($"Server connectionId {connectionId}already in use...client with address={address} will be kicked");
return false;
}
@ -696,7 +696,7 @@ static bool IsConnectionAllowed(int connectionId)
// Transport can't do that)
if (connections.Count >= maxConnections)
{
Debug.LogError($"Server full, client {connectionId} will be kicked");
Debug.LogError($"Server full, client {connectionId} with address={address} will be kicked");
return false;
}