Pings dont start immediately

This commit is contained in:
Jonas 2022-03-27 17:43:29 +02:00
parent 535edcc54c
commit 5d535c35e0
2 changed files with 4 additions and 2 deletions

View File

@ -31,12 +31,13 @@ public class ClientPinger implements Runnable {
@Override
public void run() {
try {
Thread.sleep(2000);
while (socket.isConnected()) {
gotPingBack = false;
out.write("CPING");
out.newLine();
out.flush();
Thread.sleep(5000);
Thread.sleep(4000);
if (gotPingBack) {
if (!isConnected) { //if !isConnected, then the connection had been lost before.
isConnected = true;

View File

@ -31,12 +31,13 @@ public class ServerPinger implements Runnable {
@Override
public void run() {
try {
Thread.sleep(2000);
while (socket.isConnected()) {
gotPingBack = false;
out.write("SPING");
out.newLine();
out.flush();
Thread.sleep(5000);
Thread.sleep(4000);
if (gotPingBack) {
if (!isConnected) { //if !isConnected, then the connection had been lost before.
isConnected = true;