You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-17 15:46:33 +09:00
Fixed bug in WaitMessage() - when already queued message existed it would wait for next message to arrive anyway
This commit is contained in:
@@ -159,6 +159,9 @@ namespace Lidgren.Network
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public NetIncomingMessage WaitMessage(int maxMillis)
|
public NetIncomingMessage WaitMessage(int maxMillis)
|
||||||
{
|
{
|
||||||
|
var msg = ReadMessage();
|
||||||
|
if (msg != null)
|
||||||
|
return msg; // no need to wait; we already have a message to deliver
|
||||||
if (m_messageReceivedEvent != null)
|
if (m_messageReceivedEvent != null)
|
||||||
m_messageReceivedEvent.WaitOne(maxMillis);
|
m_messageReceivedEvent.WaitOne(maxMillis);
|
||||||
return ReadMessage();
|
return ReadMessage();
|
||||||
|
|||||||
Reference in New Issue
Block a user