(e42047dc1) Tester's build, January 30th 2020

This commit is contained in:
Juan Pablo Arce
2020-01-30 15:56:31 -03:00
parent eaa18a20a3
commit 15499cb704
203 changed files with 8274 additions and 4950 deletions
@@ -506,6 +506,14 @@ namespace Lidgren.Network
}
#endif
/// <summary>
/// Changes the number of maximum connections after the peer has been started
/// </summary>
internal void ChangeMaximumConnectionsInternal(int num)
{
m_maximumConnections = num;
}
/// <summary>
/// Creates a memberwise shallow clone of this configuration
/// </summary>
+30
View File
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
namespace Lidgren.Network
{
@@ -66,5 +68,33 @@ namespace Lidgren.Network
{
return "[NetServer " + ConnectionsCount + " connections]";
}
/// <summary>
/// Changes the number of maximum allowed connections, closing existing ones if the limit is lowered below the current amount.
/// </summary>
public void ChangeMaximumConnections(int num)
{
m_configuration.ChangeMaximumConnectionsInternal(num);
int reservedSlots = m_handshakes.Count + m_connections.Count;
while (reservedSlots >= m_configuration.m_maximumConnections)
{
if (m_handshakes.Count > 0)
{
IPEndPoint endpoint = m_handshakes.Keys.Last();
// server full
NetOutgoingMessage full = CreateMessage("Server full");
full.m_messageType = NetMessageType.Disconnect;
SendLibrary(full, endpoint);
}
else
{
m_connections.Last().Disconnect("Server full");
}
reservedSlots = m_handshakes.Count + m_connections.Count;
}
}
}
}
@@ -2467,6 +2467,8 @@ namespace MonoGame.Utilities
sbyte* zout = a->zout;
for (;;)
{
if (a->zbuffer >= a->zbuffer_end) return (int)(stbi__err("overread"));
int z = (int) (stbi__zhuffman_decode(a, &a->z_length));
if ((z) < (256))
{
@@ -4787,4 +4789,4 @@ namespace MonoGame.Utilities
return (int) (stbi__info_main(s, x, y, comp));
}
}
}
}