Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -4,35 +4,36 @@ using Server.Network;
namespace Server
{
public class SocketOptions
{
private const bool NagleEnabled = false; // Should the Nagle algorithm be enabled? This may reduce performance
private const int CoalesceBufferSize = 512; // MSS that the core will use when buffering packets
public class SocketOptions
{
private const bool NagleEnabled = false; // Should the Nagle algorithm be enabled? This may reduce performance
private const int CoalesceBufferSize = 512; // MSS that the core will use when buffering packets
private static IPEndPoint[] m_ListenerEndPoints = {
new IPEndPoint( IPAddress.Any, 2593 ), // Default: Listen on port 2593 on all IP addresses
// Examples:
// new IPEndPoint( IPAddress.Any, 80 ), // Listen on port 80 on all IP addresses
// new IPEndPoint( IPAddress.Parse( "1.2.3.4" ), 2593 ), // Listen on port 2593 on IP address 1.2.3.4
};
private static IPEndPoint[] m_ListenerEndPoints =
{
new IPEndPoint(IPAddress.Any, 2593) // Default: Listen on port 2593 on all IP addresses
public static void Initialize()
{
SendQueue.CoalesceBufferSize = CoalesceBufferSize;
// Examples:
// new IPEndPoint( IPAddress.Any, 80 ), // Listen on port 80 on all IP addresses
// new IPEndPoint( IPAddress.Parse( "1.2.3.4" ), 2593 ), // Listen on port 2593 on IP address 1.2.3.4
};
EventSink.SocketConnect += EventSink_SocketConnect;
public static void Initialize()
{
SendQueue.CoalesceBufferSize = CoalesceBufferSize;
Listener.EndPoints = m_ListenerEndPoints;
}
EventSink.SocketConnect += EventSink_SocketConnect;
private static void EventSink_SocketConnect( SocketConnectEventArgs e )
{
if ( !e.AllowConnection )
return;
Listener.EndPoints = m_ListenerEndPoints;
}
if ( !NagleEnabled )
e.Socket.SetSocketOption( SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1 ); // RunUO uses its own algorithm
}
}
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
}
}
}