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

@@ -68,53 +68,52 @@ public class Config
// --------------------------------------------------
// Files
// --------------------------------------------------
// standard
private static final String FILTER_FILE = "./config/chatfilter.txt";
private static final String HEXID_FILE = "./config/hexid.txt";
private static final String IPCONFIG_FILE = "./config/ipconfig.xml";
// interface
public static final String CLASS_DAMAGE_CONFIG_FILE = "./config/custom/ClassDamage.ini";
public static final String INTERFACE_CONFIG_FILE = "./config/Interface.ini";
// main
public static final String NETWORK_CONFIG_FILE = "./config/Network.ini";
private static final String OLYMPIAD_CONFIG_FILE = "./config/Olympiad.ini";
public static final String FORTSIEGE_CONFIG_FILE = "./config/FortSiege.ini";
public static final String SIEGE_CONFIG_FILE = "./config/Siege.ini";
private static final String ACCESS_CONFIG_FILE = "./config/Access.ini";
private static final String CHARACTER_CONFIG_FILE = "./config/Character.ini";
private static final String CLANHALL_CONFIG_FILE = "./config/Clanhall.ini";
private static final String CONQUERABLE_CLANHALL_CONFIG_FILE = "./config/ConquerableHallSiege.ini";
private static final String CRAFTING_CONFIG_FILE = "./config/Crafting.ini";
private static final String ENCHANT_CONFIG_FILE = "./config/Enchant.ini";
public static final String FORTSIEGE_CONFIG_FILE = "./config/FortSiege.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 GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
private static final String OLYMP_CONFIG_FILE = "./config/Olympiad.ini";
private static final String PROTECT_FLOOD_CONFIG_FILE = "./config/FloodProtector.ini";
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
private static final String OTHER_CONFIG_FILE = "./config/Other.ini";
private static final String PROTECT_FLOOD_CONFIG_FILE = "./config/FloodProtector.ini";
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 SEVENSIGNS_CONFIG_FILE = "./config/SevenSigns.ini";
public static final String SIEGE_CONFIG_FILE = "./config/Siege.ini";
// custom
private static final String BANK_CONFIG_FILE = "./config/custom/Bank.ini";
private static final String BOSS_ANNOUNCEMENTS_CONFIG_FILE = "./config/custom/BossAnnouncements.ini";
private static final String CANCEL_SKILL_RESTORE_BUFFS_CONFIG_FILE = "./config/custom/CancelSkillRestoreBuffs.ini";
private static final String CHAMPION_CONFIG_FILE = "./config/custom/Champion.ini";
public static final String CLASS_DAMAGE_CONFIG_FILE = "./config/custom/ClassDamage.ini";
private static final String CUSTOM_AUTO_POTIONS_CONFIG_FILE = "./config/custom/AutoPotions.ini";
private static final String CUSTOM_CUSTOM_MAIL_MANAGER_CONFIG_FILE = "./config/custom/CustomMailManager.ini";
private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/custom/FactionSystem.ini";
private static final String MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/custom/MerchantZeroSellPrice.ini";
private static final String CUSTOM_RANDOM_SPAWNS_CONFIG_FILE = "./config/custom/RandomSpawns.ini";
private static final String EVENT_REBIRTH_CONFIG_FILE = "./config/custom/Rebirth.ini";
private static final String EVENT_WEDDING_CONFIG_FILE = "./config/custom/Wedding.ini";
private static final String MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/custom/MerchantZeroSellPrice.ini";
private static final String OFFLINE_CONFIG_FILE = "./config/custom/Offline.ini";
private static final String OTHER_CUSTOM_CONFIG_FILE = "./config/custom/Other.ini";
private static final String PC_BANG_POINT_CONFIG_FILE = "./config/custom/PcBang.ini";
private static final String PHYSICS_BALANCE_CONFIG_FILE = "./config/custom/PhysicsBalance.ini";
private static final String SCHEME_BUFFER_CONFIG_FILE = "./config/custom/SchemeBuffer.ini";
private static final String STARTING_LOCATION_CONFIG_FILE = "./config/custom/StartingLocation.ini";
private static final String EVENT_REBIRTH_CONFIG_FILE = "./config/custom/Rebirth.ini";
private static final String EVENT_WEDDING_CONFIG_FILE = "./config/custom/Wedding.ini";
// login
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.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";
// --------------------------------------------------
// Variable Definitions
@@ -1085,16 +1084,6 @@ public class Config
public static String GAME_SERVER_LOGIN_HOST;
public static List<String> GAME_SERVER_SUBNETS;
public static List<String> GAME_SERVER_HOSTS;
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 int REQUEST_ID;
public static boolean ACCEPT_ALTERNATE_ID;
public static File DATAPACK_ROOT;
@@ -1126,6 +1115,17 @@ public class Config
public static int PRECAUTIONARY_RESTART_PERCENTAGE;
public static int PRECAUTIONARY_RESTART_DELAY;
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 boolean SHOW_LICENCE;
public static boolean FLOOD_PROTECTION;
public static int FAST_CONNECTION_LIMIT;
@@ -1163,16 +1163,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);
DATABASE_DRIVER = serverConfig.getString("Driver", "org.mariadb.jdbc.Driver");
DATABASE_URL = serverConfig.getString("URL", "jdbc:mariadb://localhost/");
DATABASE_LOGIN = serverConfig.getString("Login", "root");
@@ -1240,6 +1230,21 @@ public class Config
PRECAUTIONARY_RESTART_DELAY = serverConfig.getInt("PrecautionaryRestartDelay", 60) * 1000;
}
public static void loadNetworkConfig()
{
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);
}
public static void loadRatesConfig()
{
final PropertiesParser ratesConfig = new PropertiesParser(RATES_CONFIG_FILE);
@@ -2060,7 +2065,7 @@ public class Config
public static void loadOlympConfig()
{
final PropertiesParser olympiadConfig = new PropertiesParser(OLYMP_CONFIG_FILE);
final PropertiesParser olympiadConfig = new PropertiesParser(OLYMPIAD_CONFIG_FILE);
OLYMPIAD_ENABLED = olympiadConfig.getBoolean("OlympiadEnabled", true);
ALT_OLY_START_TIME = olympiadConfig.getInt("AltOlyStartTime", 18);
ALT_OLY_MIN = olympiadConfig.getInt("AltOlyMin", 0);
@@ -2822,7 +2827,7 @@ public class Config
LineNumberReader lnr = null;
try
{
final File file = new File(FILTER_FILE);
final File file = new File(CHAT_FILTER_FILE);
if (!file.exists())
{
return;
@@ -2843,7 +2848,7 @@ public class Config
catch (Exception e)
{
e.printStackTrace();
throw new Error("Failed to Load " + FILTER_FILE + " File.");
throw new Error("Failed to Load " + CHAT_FILTER_FILE + " File.");
}
finally
{
@@ -2989,6 +2994,7 @@ public class Config
// Load network
loadServerConfig();
loadNetworkConfig();
// Head
loadRatesConfig();