1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-15 22:56:30 +09:00

initializing network (including binding to socket) moved out from network thread, enabling catching of exceptions

ConnectionReset on reading handled properly (by disconnecting) when only one connection
readonly added to various members
This commit is contained in:
lidgren
2010-08-11 18:34:15 +00:00
parent 4fef27d175
commit 38bb13b3a7
11 changed files with 83 additions and 93 deletions

View File

@@ -25,8 +25,8 @@ namespace Lidgren.Network
{
public partial class NetConnection
{
private int[] m_nextSendSequenceNumber;
private ushort[] m_lastReceivedSequenced;
private readonly int[] m_nextSendSequenceNumber;
private readonly ushort[] m_lastReceivedSequenced;
internal readonly List<NetSending> m_unackedSends = new List<NetSending>();
@@ -57,17 +57,7 @@ namespace Lidgren.Network
}
return retval;
}
private void InitializeReliability()
{
int num = ((int)NetMessageType.UserReliableOrdered + NetConstants.NetChannelsPerDeliveryMethod) - (int)NetMessageType.UserSequenced;
m_nextSendSequenceNumber = new int[num];
m_lastReceivedSequenced = new ushort[num];
for (int i = 0; i < m_lastReceivedSequenced.Length; i++)
m_lastReceivedSequenced[i] = ushort.MaxValue;
m_nextForceAckTime = double.MaxValue;
}
internal ushort GetSendSequenceNumber(NetMessageType mtp)
{
if (mtp < NetMessageType.UserSequenced)