Addition of FailedDecryptionLogged configuration.

This commit is contained in:
MobiusDevelopment
2023-03-16 01:23:28 +02:00
parent aa0f378c60
commit eb883e13bb
216 changed files with 1208 additions and 62 deletions

View File

@@ -1094,6 +1094,7 @@ public class Config
public static boolean TCP_NO_DELAY;
public static int CONNECTION_TIMEOUT;
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;
@@ -1171,6 +1172,7 @@ public class Config
TCP_NO_DELAY = serverConfig.getBoolean("TcpNoDelay", true);
CONNECTION_TIMEOUT = serverConfig.getInt("ConnectionTimeout", 800);
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");

View File

@@ -58,8 +58,11 @@ public class ExecuteThread<E extends NetClient> implements Runnable
}
catch (Exception e)
{
LOGGER.warning("ExecuteThread: Problem with " + client + " data decryption.");
LOGGER.warning(CommonUtil.getStackTrace(e));
if (client.getNetConfig().isFailedDecryptionLogged())
{
LOGGER.warning("ExecuteThread: Problem with " + client + " data decryption.");
LOGGER.warning(CommonUtil.getStackTrace(e));
}
client.disconnect();
continue ITERATE;
}

View File

@@ -182,6 +182,14 @@ public class NetClient
return _channel;
}
/**
* @return the network configurations of this client.
*/
public NetConfig getNetConfig()
{
return _netConfig;
}
/**
* @return the IP address of this client.
*/

View File

@@ -13,6 +13,7 @@ public class NetConfig
private boolean _packetFloodDisconnect = false;
private boolean _packetFloodDrop = false;
private boolean _packetFloodLogged = true;
private boolean _failedDecryptionLogged = true;
private boolean _tcpNoDelay = true;
/**
@@ -134,6 +135,23 @@ public class NetConfig
_packetFloodLogged = packetFloodLogged;
}
/**
* @return if failed decryption is logged.
*/
public boolean isFailedDecryptionLogged()
{
return _failedDecryptionLogged;
}
/**
* Sets if failed decryption is logged.
* @param failedDecryptionLogged
*/
public void setFailedDecryptionLogged(boolean failedDecryptionLogged)
{
_failedDecryptionLogged = failedDecryptionLogged;
}
/**
* @return if TCP_NODELAY (Nagle's Algorithm) is used.
*/

View File

@@ -479,6 +479,7 @@ public class GameServer
server.getNetConfig().setPacketFloodLogged(Config.PACKET_FLOOD_LOGGED);
server.getNetConfig().setTcpNoDelay(Config.TCP_NO_DELAY);
server.getNetConfig().setConnectionTimeout(Config.CONNECTION_TIMEOUT);
server.getNetConfig().setFailedDecryptionLogged(Config.FAILED_DECRYPTION_LOGGED);
server.start();
LoginServerThread.getInstance().start();

View File

@@ -139,6 +139,7 @@ public class LoginServer
server.getNetConfig().setExecutePoolSize(2000);
server.getNetConfig().setPacketQueueLimit(10);
server.getNetConfig().setPacketFloodDisconnect(true);
server.getNetConfig().setFailedDecryptionLogged(false);
server.start();
}