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

Optimized ReduceStoragePool ever so slightly

This commit is contained in:
lidgren
2010-09-22 20:14:57 +00:00
parent 29b7e2fe06
commit e57b45fde4

View File

@@ -189,12 +189,15 @@ namespace Lidgren.Network
wasStoredBytes = m_storedBytes;
reduceTo = m_maxStoredBytes / 2;
int remove = 0;
while (m_storedBytes > reduceTo && m_storagePool.Count > 0)
{
byte[] arr = m_storagePool[0];
m_storedBytes -= arr.Length;
m_storagePool.RemoveAt(0);
remove++;
}
if (remove > 0)
m_storagePool.RemoveRange(0, remove);
}
// done