mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkServer.IsConnectionAllowed: log address too
This commit is contained in:
parent
86302503da
commit
ef5fc77728
@ -658,7 +658,7 @@ static void OnTransportConnected(int connectionId)
|
|||||||
|
|
||||||
static void OnTransportConnectedWithAddress(int connectionId, string clientAddress)
|
static void OnTransportConnectedWithAddress(int connectionId, string clientAddress)
|
||||||
{
|
{
|
||||||
if (IsConnectionAllowed(connectionId))
|
if (IsConnectionAllowed(connectionId, clientAddress))
|
||||||
{
|
{
|
||||||
// create a connection
|
// create a connection
|
||||||
NetworkConnectionToClient conn = new NetworkConnectionToClient(connectionId, clientAddress);
|
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
|
// connectionId needs to be != 0 because 0 is reserved for local player
|
||||||
// note that some transports like kcp generate connectionId by
|
// note that some transports like kcp generate connectionId by
|
||||||
@ -685,7 +685,7 @@ static bool IsConnectionAllowed(int connectionId)
|
|||||||
// connectionId not in use yet?
|
// connectionId not in use yet?
|
||||||
if (connections.ContainsKey(connectionId))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,7 +696,7 @@ static bool IsConnectionAllowed(int connectionId)
|
|||||||
// Transport can't do that)
|
// Transport can't do that)
|
||||||
if (connections.Count >= maxConnections)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user