mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix: #3787 ThreadedTransport doesn't process Data messages after ClientDisconnect() was called anymore
This commit is contained in:
parent
3313fa9c43
commit
8b9578507a
@ -467,12 +467,18 @@ public override void ClientEarlyUpdate()
|
||||
}
|
||||
case ClientMainEventType.OnClientReceived:
|
||||
{
|
||||
// call original transport event
|
||||
ConcurrentNetworkWriterPooled writer = (ConcurrentNetworkWriterPooled)elem.param;
|
||||
OnClientDataReceived?.Invoke(writer, elem.channelId.Value);
|
||||
// immediately stop processing Data messages after ClientDisconnect() was called.
|
||||
// ClientDisconnect() sets clientConnected=false, so we can simply check that here.
|
||||
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3787
|
||||
if (clientConnected)
|
||||
{
|
||||
// call original transport event
|
||||
ConcurrentNetworkWriterPooled writer = (ConcurrentNetworkWriterPooled)elem.param;
|
||||
OnClientDataReceived?.Invoke(writer, elem.channelId.Value);
|
||||
|
||||
// recycle writer to thread safe pool for reuse
|
||||
ConcurrentNetworkWriterPool.Return(writer);
|
||||
// recycle writer to thread safe pool for reuse
|
||||
ConcurrentNetworkWriterPool.Return(writer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ClientMainEventType.OnClientError:
|
||||
|
Loading…
Reference in New Issue
Block a user