1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 07:06:30 +09:00

Fragmentation fix

This commit is contained in:
lidgren
2010-06-17 17:47:15 +00:00
parent 3bd903aeb8
commit f65504518c
3 changed files with 11 additions and 2 deletions

View File

@@ -28,6 +28,8 @@ namespace Lidgren.Network
[DebuggerDisplay("RemoteEndpoint={m_remoteEndpoint} Status={m_status}")]
public partial class NetConnection
{
private static readonly NetFragmentationInfo s_genericFragmentationInfo = new NetFragmentationInfo();
private readonly NetPeer m_owner;
internal readonly IPEndPoint m_remoteEndpoint;
internal double m_lastHeardFrom;
@@ -402,6 +404,8 @@ namespace Lidgren.Network
im.m_sequenceNumber = channelSequenceNumber;
im.m_senderConnection = this;
im.m_senderEndpoint = m_remoteEndpoint;
if (isFragment)
im.m_fragmentationInfo = s_genericFragmentationInfo;
m_owner.LogVerbose("Withholding " + im + " (waiting for " + m_nextExpectedReliableSequence[reliableSlot] + ")");
@@ -443,11 +447,13 @@ namespace Lidgren.Network
im.m_sequenceNumber = seqNr;
im.m_senderConnection = this;
im.m_senderEndpoint = m_remoteEndpoint;
NetFragmentationInfo info = new NetFragmentationInfo();
info.TotalFragmentCount = fragmentTotalCount;
info.Received = new bool[fragmentTotalCount];
info.FragmentSize = bytesLen;
im.m_fragmentationInfo = info;
m_fragmentGroups[fragmentGroup] = im;
}
@@ -457,6 +463,7 @@ namespace Lidgren.Network
return;
// all received!
im.m_fragmentationInfo = null;
m_fragmentGroups.Remove(fragmentGroup);
}
else