Skip to content

Commit fc6e757

Browse files
authored
fix: flushing send and receive queues upon disconnection (#2274)
1 parent e4d0e7d commit fc6e757

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,7 @@ private void OnDestroy()
13411341
private void DisconnectRemoteClient(ulong clientId)
13421342
{
13431343
var transportId = ClientIdToTransportId(clientId);
1344+
MessagingSystem.ProcessSendQueues();
13441345
NetworkConfig.NetworkTransport.DisconnectRemoteClient(transportId);
13451346
}
13461347

@@ -1821,6 +1822,10 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, A
18211822
NetworkLog.LogInfo($"Disconnect Event From {clientId}");
18221823
}
18231824

1825+
// Process the incoming message queue so that we get everything from the server disconnecting us
1826+
// or, if we are the server, so we got everything from that client.
1827+
MessagingSystem.ProcessIncomingMessageQueue();
1828+
18241829
OnClientDisconnectCallback?.Invoke(clientId);
18251830

18261831
if (IsServer)

0 commit comments

Comments
 (0)