Tried adding smt to avoid being kicked off the Server
This commit is contained in:
@@ -35,12 +35,20 @@ public class ClientPinger implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Thread.currentThread().setPriority(10);
|
||||
try {
|
||||
Thread.sleep(20000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
while (socket.isConnected() && !socket.isClosed()) {
|
||||
gotPingBack = false;
|
||||
client.sendMsgToServer(Protocol.pingFromClient);
|
||||
try {
|
||||
Thread.sleep(4000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
if (gotPingBack) {
|
||||
if (!isConnected) { //if !isConnected, then the connection had been lost before.
|
||||
isConnected = true;
|
||||
@@ -54,9 +62,6 @@ public class ClientPinger implements Runnable {
|
||||
}
|
||||
}
|
||||
isConnected = false;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setGotPingBack(boolean gotPingBack) {
|
||||
|
||||
@@ -37,6 +37,7 @@ public class ServerPinger implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Thread.currentThread().setPriority(10);
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
while (socket.isConnected() && !socket.isClosed()) {
|
||||
|
||||
Reference in New Issue
Block a user