Addition of network configuration file.

This commit is contained in:
MobiusDevelopment
2023-07-03 00:58:15 +03:00
parent d374a32cf4
commit 5f31c3055c
92 changed files with 2515 additions and 2102 deletions

View File

@@ -0,0 +1,53 @@
# ---------------------------------------------------------------------------------------------------------------------------------
# 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: 25
ClientSendPoolSize = 25
# Client pool size for executing client packets.
# Each pool is executed on a separate thread.
# Default: 50
ClientExecutePoolSize = 50
# Expected client packet count queued by the server.
# Default: 80
PacketQueueLimit = 80
# Disconnect client when queue has reached the queue packet limit.
# Default: False
PacketFloodDisconnect = False
# 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
# 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,
# also broadcasted packets do not need to be re-encrypted for each client sent.
# Retail: True
PacketEncryption = False
# Log message when packet decryption has failed.
# Default: True
FailedDecryptionLogged = True

View File

@@ -31,54 +31,6 @@ GameserverHostname = 0.0.0.0
# Default: 7777
GameserverPort = 7777
# 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: 25
ClientSendPoolSize = 25
# Client pool size for executing client packets.
# Each pool is executed on a separate thread.
# Default: 50
ClientExecutePoolSize = 50
# Expected client packet count queued by the server.
# Default: 80
PacketQueueLimit = 80
# Disconnect client when queue has reached the queue packet limit.
# Default: False
PacketFloodDisconnect = False
# 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
# 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,
# also broadcasted packets do not need to be re-encrypted for each client sent.
# Retail: True
PacketEncryption = False
# Log message when packet decryption has failed.
# Default: True
FailedDecryptionLogged = True
# ---------------------------------------------------------------------------
# Database

View File

@@ -89,6 +89,7 @@ public class Config
// --------------------------------------------------
public static final String GEOENGINE_CONFIG_FILE = "./config/GeoEngine.ini";
public static final String INTERFACE_CONFIG_FILE = "./config/Interface.ini";
public static final String NETWORK_CONFIG_FILE = "./config/Network.ini";
public static final String OLYMPIAD_CONFIG_FILE = "./config/Olympiad.ini";
public static final String SIEGE_CONFIG_FILE = "./config/Siege.ini";
public static final String FORTSIEGE_CONFIG_FILE = "./config/FortSiege.ini";
@@ -767,16 +768,6 @@ public class Config
public static int LOGIN_TRY_BEFORE_BAN;
public static int LOGIN_BLOCK_AFTER_BAN;
public static String GAMESERVER_HOSTNAME;
public static int CLIENT_READ_POOL_SIZE;
public static int CLIENT_SEND_POOL_SIZE;
public static int CLIENT_EXECUTE_POOL_SIZE;
public static int PACKET_QUEUE_LIMIT;
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 String DATABASE_DRIVER;
public static String DATABASE_URL;
public static String DATABASE_LOGIN;
@@ -817,6 +808,20 @@ public class Config
public static int PRECAUTIONARY_RESTART_PERCENTAGE;
public static int PRECAUTIONARY_RESTART_DELAY;
// --------------------------------------------------
// Network Settings
// --------------------------------------------------
public static int CLIENT_READ_POOL_SIZE;
public static int CLIENT_SEND_POOL_SIZE;
public static int CLIENT_EXECUTE_POOL_SIZE;
public static int PACKET_QUEUE_LIMIT;
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;
// --------------------------------------------------
// Hardin (Agent of Chaos)
// --------------------------------------------------
@@ -1538,6 +1543,18 @@ public class Config
PRECAUTIONARY_RESTART_PERCENTAGE = serverConfig.getInt("PrecautionaryRestartPercentage", 95);
PRECAUTIONARY_RESTART_DELAY = serverConfig.getInt("PrecautionaryRestartDelay", 60) * 1000;
final PropertiesParser networkConfig = new PropertiesParser(NETWORK_CONFIG_FILE);
CLIENT_READ_POOL_SIZE = networkConfig.getInt("ClientReadPoolSize", 100);
CLIENT_SEND_POOL_SIZE = networkConfig.getInt("ClientSendPoolSize", 25);
CLIENT_EXECUTE_POOL_SIZE = networkConfig.getInt("ClientExecutePoolSize", 50);
PACKET_QUEUE_LIMIT = networkConfig.getInt("PacketQueueLimit", 80);
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);
// Hosts and Subnets
final IPConfigData ipcd = new IPConfigData();
GAME_SERVER_SUBNETS = ipcd.getSubnets();