LoginServer should also use the Network.ini configuration file.

This commit is contained in:
MobiusDevelopment
2023-07-12 01:15:21 +03:00
parent 96a579ee4a
commit 900674e177
153 changed files with 2247 additions and 457 deletions

View File

@@ -35,12 +35,6 @@ PacketFloodDrop = False
# Default: True
PacketFloodLogged = True
# Nagle's algorithm tries to conserve bandwidth by minimizing the number of segments that are sent.
# When applications wish to decrease network latency, they can disable Nagle's algorithm (by enabling TcpNoDelay).
# Data will be sent earlier, at the cost of an increase in bandwidth consumption.
# Default: True (disabled)
TcpNoDelay = True
# Packet encryption.
# By default packets sent or received are encrypted using the Blowfish algorithm.
# Disabling this reduces the resources needed to process any packets transfered,
@@ -51,3 +45,9 @@ PacketEncryption = False
# Log message when packet decryption has failed.
# Default: True
FailedDecryptionLogged = True
# Nagle's algorithm tries to conserve bandwidth by minimizing the number of segments that are sent.
# When applications wish to decrease network latency, they can disable Nagle's algorithm (by enabling TcpNoDelay).
# Data will be sent earlier, at the cost of an increase in bandwidth consumption.
# Default: True (disabled)
TcpNoDelay = True

View File

@@ -0,0 +1,46 @@
# ---------------------------------------------------------------------------------------------------------------------------------
# Network Settings
# These settings provide fine-grained control over the network behavior and packet handling within the server application.
# Adjusting these parameters can help optimize network performance and ensure secure communication between the server and clients.
# ---------------------------------------------------------------------------------------------------------------------------------
# Client pool size for reading client packets.
# Each pool is executed on a separate thread.
# Default: 100
ClientReadPoolSize = 100
# Client pool size for sending server packets.
# Each pool is executed on a separate thread.
# Default: 100
ClientSendPoolSize = 100
# Client pool size for executing client packets.
# Each pool is executed on a separate thread.
# Default: 100
ClientExecutePoolSize = 100
# Expected client packet count queued by the server.
# Default: 80
PacketQueueLimit = 80
# Disconnect client when queue has reached the queue packet limit.
# Default: True
PacketFloodDisconnect = True
# Drop packets when queue has reached the queue packet limit.
# Default: False
PacketFloodDrop = False
# Log message when queue has reached the queue packet limit.
# Default: True
PacketFloodLogged = True
# Log message when packet decryption has failed.
# Default: False
FailedDecryptionLogged = False
# Nagle's algorithm tries to conserve bandwidth by minimizing the number of segments that are sent.
# When applications wish to decrease network latency, they can disable Nagle's algorithm (by enabling TcpNoDelay).
# Data will be sent earlier, at the cost of an increase in bandwidth consumption.
# Default: True (disabled)
TcpNoDelay = True

View File

@@ -817,9 +817,9 @@ public class Config
public static boolean PACKET_FLOOD_DISCONNECT;
public static boolean PACKET_FLOOD_DROP;
public static boolean PACKET_FLOOD_LOGGED;
public static boolean TCP_NO_DELAY;
public static boolean PACKET_ENCRYPTION;
public static boolean FAILED_DECRYPTION_LOGGED;
public static boolean TCP_NO_DELAY;
// --------------------------------------------------
// Hardin (Agent of Chaos)
@@ -1549,9 +1549,9 @@ public class Config
PACKET_FLOOD_DISCONNECT = networkConfig.getBoolean("PacketFloodDisconnect", false);
PACKET_FLOOD_DROP = networkConfig.getBoolean("PacketFloodDrop", false);
PACKET_FLOOD_LOGGED = networkConfig.getBoolean("PacketFloodLogged", true);
TCP_NO_DELAY = networkConfig.getBoolean("TcpNoDelay", true);
PACKET_ENCRYPTION = networkConfig.getBoolean("PacketEncryption", false);
FAILED_DECRYPTION_LOGGED = networkConfig.getBoolean("FailedDecryptionLogged", true);
TCP_NO_DELAY = networkConfig.getBoolean("TcpNoDelay", true);
// Hosts and Subnets
final IPConfigData ipcd = new IPConfigData();
@@ -3754,6 +3754,17 @@ public class Config
MAX_CONNECTION_PER_IP = loginConfig.getInt("MaxConnectionPerIP", 50);
ENABLE_CMD_LINE_LOGIN = loginConfig.getBoolean("EnableCmdLineLogin", false);
ONLY_CMD_LINE_LOGIN = loginConfig.getBoolean("OnlyCmdLineLogin", false);
final PropertiesParser networkConfig = new PropertiesParser(NETWORK_CONFIG_FILE);
CLIENT_READ_POOL_SIZE = networkConfig.getInt("ClientReadPoolSize", 100);
CLIENT_SEND_POOL_SIZE = networkConfig.getInt("ClientSendPoolSize", 100);
CLIENT_EXECUTE_POOL_SIZE = networkConfig.getInt("ClientExecutePoolSize", 100);
PACKET_QUEUE_LIMIT = networkConfig.getInt("PacketQueueLimit", 80);
PACKET_FLOOD_DISCONNECT = networkConfig.getBoolean("PacketFloodDisconnect", true);
PACKET_FLOOD_DROP = networkConfig.getBoolean("PacketFloodDrop", false);
PACKET_FLOOD_LOGGED = networkConfig.getBoolean("PacketFloodLogged", true);
FAILED_DECRYPTION_LOGGED = networkConfig.getBoolean("FailedDecryptionLogged", false);
TCP_NO_DELAY = networkConfig.getBoolean("TcpNoDelay", true);
}
else
{

View File

@@ -498,8 +498,8 @@ public class GameServer
server.getNetConfig().setPacketFloodDisconnect(Config.PACKET_FLOOD_DISCONNECT);
server.getNetConfig().setPacketFloodDrop(Config.PACKET_FLOOD_DROP);
server.getNetConfig().setPacketFloodLogged(Config.PACKET_FLOOD_LOGGED);
server.getNetConfig().setTcpNoDelay(Config.TCP_NO_DELAY);
server.getNetConfig().setFailedDecryptionLogged(Config.FAILED_DECRYPTION_LOGGED);
server.getNetConfig().setTcpNoDelay(Config.TCP_NO_DELAY);
server.start();
LoginServerThread.getInstance().start();

View File

@@ -135,12 +135,15 @@ public class LoginServer
final NetServer<LoginClient> server = new NetServer<>(Config.LOGIN_BIND_ADDRESS, Config.PORT_LOGIN, new LoginPacketHandler(), LoginClient::new);
server.setName(getClass().getSimpleName());
server.getNetConfig().setReadPoolSize(2000);
server.getNetConfig().setSendPoolSize(2000);
server.getNetConfig().setExecutePoolSize(2000);
server.getNetConfig().setPacketQueueLimit(10);
server.getNetConfig().setPacketFloodDisconnect(true);
server.getNetConfig().setFailedDecryptionLogged(false);
server.getNetConfig().setReadPoolSize(Config.CLIENT_READ_POOL_SIZE);
server.getNetConfig().setSendPoolSize(Config.CLIENT_SEND_POOL_SIZE);
server.getNetConfig().setExecutePoolSize(Config.CLIENT_EXECUTE_POOL_SIZE);
server.getNetConfig().setPacketQueueLimit(Config.PACKET_QUEUE_LIMIT);
server.getNetConfig().setPacketFloodDisconnect(Config.PACKET_FLOOD_DISCONNECT);
server.getNetConfig().setPacketFloodDrop(Config.PACKET_FLOOD_DROP);
server.getNetConfig().setPacketFloodLogged(Config.PACKET_FLOOD_LOGGED);
server.getNetConfig().setFailedDecryptionLogged(Config.FAILED_DECRYPTION_LOGGED);
server.getNetConfig().setTcpNoDelay(Config.TCP_NO_DELAY);
server.start();
}