Removed interruption from pinger
This commit is contained in:
parent
67cd93403a
commit
d45d64a9c7
@ -38,30 +38,26 @@ public class ClientPinger implements Runnable {
|
|||||||
Thread.currentThread().setPriority(10);
|
Thread.currentThread().setPriority(10);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(20000);
|
Thread.sleep(20000);
|
||||||
} catch (InterruptedException e) {
|
while (socket.isConnected() && !socket.isClosed()) {
|
||||||
Thread.currentThread().interrupt();
|
gotPingBack = false;
|
||||||
}
|
client.sendMsgToServer(Protocol.pingFromClient);
|
||||||
while (socket.isConnected() && !socket.isClosed()) {
|
|
||||||
gotPingBack = false;
|
|
||||||
client.sendMsgToServer(Protocol.pingFromClient);
|
|
||||||
try {
|
|
||||||
Thread.sleep(4000);
|
Thread.sleep(4000);
|
||||||
} catch (InterruptedException e) {
|
if (gotPingBack) {
|
||||||
Thread.currentThread().interrupt();
|
if (!isConnected) { //if !isConnected, then the connection had been lost before.
|
||||||
}
|
isConnected = true;
|
||||||
if (gotPingBack) {
|
System.out.println("Connection regained!");
|
||||||
if (!isConnected) { //if !isConnected, then the connection had been lost before.
|
}
|
||||||
isConnected = true;
|
} else {
|
||||||
System.out.println("Connection regained!");
|
if (isConnected) {
|
||||||
}
|
isConnected = false;
|
||||||
} else {
|
System.out.println("Lost connection. Waiting to reconnect...");
|
||||||
if (isConnected) {
|
}
|
||||||
isConnected = false;
|
|
||||||
System.out.println("Lost connection. Waiting to reconnect...");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isConnected = false;
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
isConnected = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGotPingBack(boolean gotPingBack) {
|
public void setGotPingBack(boolean gotPingBack) {
|
||||||
|
|||||||
Reference in New Issue
Block a user