diff --git a/Lidgren.Network/NetConnection.Handshake.cs b/Lidgren.Network/NetConnection.Handshake.cs index 246b6f1..e8b9114 100644 --- a/Lidgren.Network/NetConnection.Handshake.cs +++ b/Lidgren.Network/NetConnection.Handshake.cs @@ -93,7 +93,7 @@ namespace Lidgren.Network { m_peer.VerifyNetworkThread(); - // m_peer.LogDebug("Executing disconnect"); + //m_peer.LogDebug("Executing disconnect"); // clear send queues for (int i = 0; i < m_sendChannels.Length; i++) diff --git a/Lidgren.Network/NetPeer.Internal.cs b/Lidgren.Network/NetPeer.Internal.cs index 2a2faaf..4b21d6d 100644 --- a/Lidgren.Network/NetPeer.Internal.cs +++ b/Lidgren.Network/NetPeer.Internal.cs @@ -212,9 +212,13 @@ namespace Lidgren.Network } } + FlushDelayedPackets(); + // one final heartbeat, will send stuff and do disconnect Heartbeat(); + Thread.Sleep(10); + lock (m_initializeLock) { try diff --git a/Lidgren.Network/NetPeer.LatencySimulation.cs b/Lidgren.Network/NetPeer.LatencySimulation.cs index 7497b31..0f4863f 100644 --- a/Lidgren.Network/NetPeer.LatencySimulation.cs +++ b/Lidgren.Network/NetPeer.LatencySimulation.cs @@ -112,6 +112,18 @@ namespace Lidgren.Network } } + private void FlushDelayedPackets() + { + try + { + bool connectionReset; + foreach (DelayedPacket p in m_delayedPackets) + ActuallySendPacket(p.Data, p.Data.Length, p.Target, out connectionReset); + m_delayedPackets.Clear(); + } + catch { } + } + internal bool ActuallySendPacket(byte[] data, int numBytes, IPEndPoint target, out bool connectionReset) { connectionReset = false; @@ -272,6 +284,10 @@ namespace Lidgren.Network return; } + private void FlushDelayedPackets() + { + } + private void SendCallBack(IAsyncResult res) { NetException.Assert(res.IsCompleted == true);