Skip to content

Commit 0eda04f

Browse files
authored
Update FacepunchTransport.cs (#246)
workaround/possible fix: #245
1 parent 8eab2c9 commit 0eda04f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Transports/com.community.netcode.transport.facepunch/Runtime/FacepunchTransport.cs

+9-6
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,15 @@ void ISocketManager.OnConnected(SocketConnection connection, ConnectionInfo info
261261

262262
void ISocketManager.OnDisconnected(SocketConnection connection, ConnectionInfo info)
263263
{
264-
connectedClients.Remove(connection.Id);
265-
266-
InvokeOnTransportEvent(NetworkEvent.Disconnect, connection.Id, default, Time.realtimeSinceStartup);
267-
268-
if (LogLevel <= LogLevel.Developer)
269-
Debug.Log($"[{nameof(FacepunchTransport)}] - Disconnected Steam user {info.Identity.SteamId}");
264+
if (connectedClients.Remove(connection.Id))
265+
{
266+
InvokeOnTransportEvent(NetworkEvent.Disconnect, connection.Id, default, Time.realtimeSinceStartup);
267+
268+
if (LogLevel <= LogLevel.Developer)
269+
Debug.Log($"[{nameof(FacepunchTransport)}] - Disconnected Steam user {info.Identity.SteamId}");
270+
}
271+
else if (LogLevel <= LogLevel.Normal)
272+
Debug.LogWarning($"[{nameof(FacepunchTransport)}] - Failed to diconnect client with ID {connection.Id}, client not connected.");
270273
}
271274

272275
unsafe void ISocketManager.OnMessage(SocketConnection connection, NetIdentity identity, IntPtr data, int size, long messageNum, long recvTime, int channel)

0 commit comments

Comments
 (0)