Cleaned up client disconnect scenario.

This commit is contained in:
Andrew Lalis 2021-06-23 22:39:22 +02:00
parent 4e01673bf8
commit ee6d7a00cb
2 changed files with 1 additions and 3 deletions

View File

@ -88,9 +88,6 @@ public class ClientHandler extends Thread {
public void shutdown() {
this.running = false;
if (!this.socket.isClosed()) {
this.send(new Message(Type.SERVER_SHUTDOWN));
}
this.sendingQueue.shutdown();
try {
boolean terminated = false;

View File

@ -185,6 +185,7 @@ public class Server {
try {
this.serverSocket.close();
for (ClientHandler handler : this.clientHandlers) {
handler.send(new Message(Type.SERVER_SHUTDOWN));
handler.shutdown();
}
} catch (IOException e) {