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

File stream sample added

This commit is contained in:
lidgren
2010-11-14 23:05:32 +00:00
parent e8e7268421
commit 936e329b40
27 changed files with 1508 additions and 7 deletions

View File

@@ -295,10 +295,10 @@ namespace Lidgren.Network
{
case NetDeliveryMethod.Unreliable:
case NetDeliveryMethod.UnreliableSequenced:
chan = new NetUnreliableSenderChannel(this, NetConstants.UnreliableWindowSize);
chan = new NetUnreliableSenderChannel(this, NetUtility.GetWindowSize(method));
break;
case NetDeliveryMethod.ReliableOrdered:
chan = new NetReliableSenderChannel(this, NetConstants.ReliableOrderedWindowSize);
chan = new NetReliableSenderChannel(this, NetUtility.GetWindowSize(method));
break;
case NetDeliveryMethod.ReliableSequenced:
case NetDeliveryMethod.ReliableUnordered:
@@ -306,7 +306,7 @@ namespace Lidgren.Network
//
// TODO: this is placeholder!
//
chan = new NetReliableSenderChannel(this, 64);
chan = new NetReliableSenderChannel(this, NetUtility.GetWindowSize(method));
break;
}
@@ -424,8 +424,8 @@ namespace Lidgren.Network
var chan = m_sendChannels[channelSlot];
if (chan == null)
{
windowSize = 0;
freeWindowSlots = 0;
windowSize = NetUtility.GetWindowSize(method);
freeWindowSlots = windowSize;
return;
}

View File

@@ -36,6 +36,7 @@ namespace Lidgren.Network
internal const int UnreliableWindowSize = 128;
internal const int ReliableOrderedWindowSize = 64;
internal const int ReliableSequencedWindowSize = 64;
internal const int DefaultWindowSize = 64;
internal const int MaxFragmentationGroups = ushort.MaxValue - 1;

View File

@@ -283,6 +283,27 @@ namespace Lidgren.Network
return retval;
}
public static int GetWindowSize(NetDeliveryMethod method)
{
switch (method)
{
case NetDeliveryMethod.Unknown:
return 0;
case NetDeliveryMethod.Unreliable:
case NetDeliveryMethod.UnreliableSequenced:
return NetConstants.UnreliableWindowSize;
case NetDeliveryMethod.ReliableOrdered:
return NetConstants.ReliableOrderedWindowSize;
case NetDeliveryMethod.ReliableSequenced:
case NetDeliveryMethod.ReliableUnordered:
default:
return NetConstants.DefaultWindowSize;
}
}
// shell sort
internal static void SortMembersList(System.Reflection.MemberInfo[] list)
{