Now the client disconnects if:

1. no pingback recieved
2. isConnected has already been set to false
In this case it looks to be a case where the client isn't responding correctly and the server may close the connection. Added a debog log statement at the respective place.
This commit is contained in:
Sebastian Lenzlinger 2022-04-08 16:12:19 +02:00
parent f57889431d
commit 968cb94f21

View File

@ -14,6 +14,7 @@ import org.apache.logging.log4j.Logger;
* how the server receives and parses messages.
*/
public class ServerPinger implements Runnable {
public static final Logger LOGGER = LogManager.getLogger();
public static final BudaLogConfig l = new BudaLogConfig(LOGGER);
@ -50,7 +51,13 @@ public class ServerPinger implements Runnable {
} else {
if (isConnected) {
isConnected = false;
System.out.println("Lost connection to user " + c.getClientUserName() + ". Waiting to reconnect...");
//TODO: Possibly an incorrect statement since this can also happen if a client is not adhearing to the protocol
System.out.println(
"Lost connection to user " + c.getClientUserName() + ". Waiting to reconnect...");
} else {
c.disconnectClient();
LOGGER.debug(
"gotPingBack has not been set to true and isConnected has been set to false before");
}
}
}