LibUv Networking (#65)

This commit is contained in:
Kamron Batman 2019-12-26 18:08:50 -08:00 committed by GitHub
parent ec6629fbe9
commit 5e2be2d7b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
69 changed files with 5612 additions and 586 deletions

View file

@ -5,8 +5,6 @@ namespace Server
{
public class SocketOptions
{
private const bool NagleEnabled = false; // Should the Nagle algorithm be enabled? This may reduce performance
private static IPEndPoint[] m_ListenerEndPoints =
{
new IPEndPoint(IPAddress.Any, 2593) // Default: Listen on port 2593 on all IP addresses
@ -16,24 +14,10 @@ namespace Server
// new IPEndPoint( IPAddress.Parse( "1.2.3.4" ), 2593 ), // Listen on port 2593 on IP address 1.2.3.4
};
public static void Initialize()
{
EventSink.SocketConnect += EventSink_SocketConnect;
}
public static void RegisterListeners()
{
for (int i = 0; i < m_ListenerEndPoints.Length; i++)
Core.MessagePump.AddListener(m_ListenerEndPoints[i]);
}
private static void EventSink_SocketConnect(SocketConnectEventArgs e)
{
if (!e.AllowConnection)
return;
if (!NagleEnabled)
e.Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1); // RunUO uses its own algorithm
}
}
}