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

Fixed GetMTU not to generate garbage

This commit is contained in:
lidgren
2012-07-02 07:09:47 +00:00
parent fbb6d9ed51
commit e0c3a34b91

View File

@@ -64,11 +64,13 @@ namespace Lidgren.Network
internal int GetMTU(IList<NetConnection> recipients) internal int GetMTU(IList<NetConnection> recipients)
{ {
NetException.Assert(recipients.Count > 0); int count = recipients.Count;
NetException.Assert(count > 0);
int mtu = int.MaxValue; int mtu = int.MaxValue;
foreach (NetConnection conn in recipients) for(int i=0;i<count;i++)
{ {
var conn = recipients[i];
int cmtu = conn.m_currentMTU; int cmtu = conn.m_currentMTU;
if (cmtu < mtu) if (cmtu < mtu)
mtu = cmtu; mtu = cmtu;