1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 23:26:32 +09:00

m_needFlushSendQueue added to prevent traversing sender channels each heartbeat

This commit is contained in:
Michael Lidgren
2015-01-20 17:39:03 +01:00
parent f95a6e02c4
commit d57f7045fe
6 changed files with 24 additions and 7 deletions

View File

@@ -26,6 +26,7 @@ namespace Lidgren.Network
private double m_lastHeartbeat;
private double m_lastSocketBind = float.MinValue;
private NetUPnP m_upnp;
internal bool m_needFlushSendQueue;
internal readonly NetPeerConfiguration m_configuration;
private readonly NetQueue<NetIncomingMessage> m_releasedIncomingMessages;
@@ -368,8 +369,11 @@ namespace Lidgren.Network
#endif
// update m_executeFlushSendQueue
if (m_configuration.m_autoFlushSendQueue)
if (m_configuration.m_autoFlushSendQueue && m_needFlushSendQueue == true)
{
m_executeFlushSendQueue = true;
m_needFlushSendQueue = false; // a race condition to this variable will simply result in a single superfluous call to FlushSendQueue()
}
// do connection heartbeats
lock (m_connections)