Open zach-r-d opened 2 years ago
Call ms.ToArray() outside of the lock (IncomingMessageLock) sections in Receive(). This prevents the Unity main thread blocking on IncomingMessageLock if ms.ToArray() is copying a large number of bytes.
ms.ToArray()
lock (IncomingMessageLock)
Receive()
IncomingMessageLock
Call
ms.ToArray()
outside of thelock (IncomingMessageLock)
sections inReceive()
. This prevents the Unity main thread blocking onIncomingMessageLock
ifms.ToArray()
is copying a large number of bytes.