Merge remote-tracking branch 'origin/Jonas_Stuff' into Jonas_Stuff

This commit is contained in:
Seraina 2022-03-27 17:49:52 +02:00
commit 55a5fe50b7
2 changed files with 4 additions and 2 deletions

View File

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

View File

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