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

@@ -86,17 +86,20 @@ public class Config
// --------------------------------------------------
// Config File Definitions
// --------------------------------------------------
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";
public static final String SIEGE_CONFIG_FILE = "./config/Siege.ini";
public static final String TW_CONFIG_FILE = "./config/TerritoryWar.ini";
private static final String CHARACTER_CONFIG_FILE = "./config/Character.ini";
private static final String CH_SIEGE_CONFIG_FILE = "./config/ConquerableHallSiege.ini";
private static final String FEATURE_CONFIG_FILE = "./config/Feature.ini";
private static final String FLOOD_PROTECTOR_CONFIG_FILE = "./config/FloodProtector.ini";
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
private static final String GEOENGINE_CONFIG_FILE = "./config/GeoEngine.ini";
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
@@ -104,6 +107,7 @@ public class Config
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
private static final String HEXID_FILE = "./config/hexid.txt";
private static final String IPCONFIG_FILE = "./config/ipconfig.xml";
@@ -891,16 +895,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;
@@ -942,13 +936,18 @@ public class Config
public static int PRECAUTIONARY_RESTART_DELAY;
// --------------------------------------------------
// MMO Settings
// Network Settings
// --------------------------------------------------
public static int MMO_SELECTOR_SLEEP_TIME;
public static int MMO_MAX_SEND_PER_PASS;
public static int MMO_MAX_READ_PER_PASS;
public static int MMO_HELPER_BUFFER_COUNT;
public static boolean MMO_TCP_NODELAY;
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;
// --------------------------------------------------
// Vitality Settings
@@ -1385,16 +1384,6 @@ public class Config
PORT_GAME = serverConfig.getInt("GameserverPort", 7777);
GAME_SERVER_LOGIN_PORT = serverConfig.getInt("LoginPort", 9014);
GAME_SERVER_LOGIN_HOST = serverConfig.getString("LoginHost", "127.0.0.1");
CLIENT_READ_POOL_SIZE = serverConfig.getInt("ClientReadPoolSize", 100);
CLIENT_SEND_POOL_SIZE = serverConfig.getInt("ClientSendPoolSize", 25);
CLIENT_EXECUTE_POOL_SIZE = serverConfig.getInt("ClientExecutePoolSize", 50);
PACKET_QUEUE_LIMIT = serverConfig.getInt("PacketQueueLimit", 80);
PACKET_FLOOD_DISCONNECT = serverConfig.getBoolean("PacketFloodDisconnect", false);
PACKET_FLOOD_DROP = serverConfig.getBoolean("PacketFloodDrop", false);
PACKET_FLOOD_LOGGED = serverConfig.getBoolean("PacketFloodLogged", true);
TCP_NO_DELAY = serverConfig.getBoolean("TcpNoDelay", true);
PACKET_ENCRYPTION = serverConfig.getBoolean("PacketEncryption", false);
FAILED_DECRYPTION_LOGGED = serverConfig.getBoolean("FailedDecryptionLogged", true);
REQUEST_ID = serverConfig.getInt("RequestServerID", 0);
ACCEPT_ALTERNATE_ID = serverConfig.getBoolean("AcceptAlternateID", true);
DATABASE_DRIVER = serverConfig.getString("Driver", "org.mariadb.jdbc.Driver");
@@ -1496,6 +1485,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();