mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 08:58:02 -04:00
handle Socket close exception correctly (this is not failed^^)
This commit is contained in:
parent
744189c745
commit
d609b537b9
@ -35,6 +35,7 @@ import java.io.OutputStream;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.net.SocketException;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
public class Network {
|
public class Network {
|
||||||
@ -238,14 +239,17 @@ public class Network {
|
|||||||
disconnect();
|
disconnect();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Could not connect
|
// Could not connect
|
||||||
lastException = e;
|
|
||||||
connection.setConnectionState(ConnectionStates.FAILED);
|
|
||||||
if (socketSThread != null) {
|
|
||||||
socketSThread.interrupt();
|
|
||||||
}
|
|
||||||
if (Log.getLevel().ordinal() >= LogLevels.DEBUG.ordinal()) {
|
if (Log.getLevel().ordinal() >= LogLevels.DEBUG.ordinal()) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
if (socketSThread != null) {
|
||||||
|
socketSThread.interrupt();
|
||||||
|
}
|
||||||
|
if (e instanceof SocketException && e.getMessage().equals("Socket closed")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lastException = e;
|
||||||
|
connection.setConnectionState(ConnectionStates.FAILED);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
socketRThread.setName(String.format("%d/Socket", connection.getConnectionId()));
|
socketRThread.setName(String.format("%d/Socket", connection.getConnectionId()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user