From ee6d7a00cb4814aaf6076b4b03b4e17b89178432 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Wed, 23 Jun 2021 22:39:22 +0200 Subject: [PATCH] Cleaned up client disconnect scenario. --- .../src/main/java/nl/andrewlalis/aos_server/ClientHandler.java | 3 --- server/src/main/java/nl/andrewlalis/aos_server/Server.java | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/server/src/main/java/nl/andrewlalis/aos_server/ClientHandler.java b/server/src/main/java/nl/andrewlalis/aos_server/ClientHandler.java index 4a3f527..42bee1d 100644 --- a/server/src/main/java/nl/andrewlalis/aos_server/ClientHandler.java +++ b/server/src/main/java/nl/andrewlalis/aos_server/ClientHandler.java @@ -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; diff --git a/server/src/main/java/nl/andrewlalis/aos_server/Server.java b/server/src/main/java/nl/andrewlalis/aos_server/Server.java index 5afd364..6ef0ee3 100644 --- a/server/src/main/java/nl/andrewlalis/aos_server/Server.java +++ b/server/src/main/java/nl/andrewlalis/aos_server/Server.java @@ -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) {