1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-17 15:46:33 +09:00

Added NetConnection.CanSendImmediately() to determine if the sliding window is full

Recycle outgoing dropped messages
Encryption using CryptoProviders refactored 
Added NetUnreliableSizeBehaviour to configure behaviour for unreliable messages above MTU
Debug stats show number of received fragments
This commit is contained in:
lidgren
2014-10-10 15:25:54 +00:00
parent 7822a14526
commit 0d2955637d
26 changed files with 217 additions and 680 deletions

View File

@@ -56,6 +56,7 @@ namespace Lidgren.Network
internal float m_connectionTimeout;
internal bool m_enableUPnP;
internal bool m_autoFlushSendQueue;
private NetUnreliableSizeBehaviour m_unreliableSizeBehaviour;
internal NetIncomingMessageType m_disabledTypes;
internal int m_port;
@@ -114,6 +115,7 @@ namespace Lidgren.Network
m_autoExpandMTU = false;
m_expandMTUFrequency = 2.0f;
m_expandMTUFailAttempts = 5;
m_unreliableSizeBehaviour = NetUnreliableSizeBehaviour.IgnoreMTU;
m_loss = 0.0f;
m_minimumOneWayLatency = 0.0f;
@@ -171,6 +173,15 @@ namespace Lidgren.Network
return !((m_disabledTypes & type) == type);
}
/// <summary>
/// Gets or sets the behaviour of unreliable sends above MTU
/// </summary>
public NetUnreliableSizeBehaviour UnreliableSizeBehaviour
{
get { return m_unreliableSizeBehaviour; }
set { m_unreliableSizeBehaviour = value; }
}
/// <summary>
/// Gets or sets the name of the library network thread. Cannot be changed once NetPeer is initialized.
/// </summary>
@@ -474,4 +485,25 @@ namespace Lidgren.Network
return retval;
}
}
/// <summary>
/// Behaviour of unreliable sends above MTU
/// </summary>
public enum NetUnreliableSizeBehaviour
{
/// <summary>
/// Sending an unreliable message will ignore MTU and send everything in a single packet; this is the new default
/// </summary>
IgnoreMTU = 0,
/// <summary>
/// Old behaviour; use normal fragmentation for unreliable messages - if a fragment is dropped, memory for received fragments are never reclaimed!
/// </summary>
NormalFragmentation = 1,
/// <summary>
/// Alternate behaviour; just drops unreliable messages above MTU
/// </summary>
DropAboveMTU = 2,
}
}