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() { public void shutdown() {
this.running = false; this.running = false;
if (!this.socket.isClosed()) {
this.send(new Message(Type.SERVER_SHUTDOWN));
}
this.sendingQueue.shutdown(); this.sendingQueue.shutdown();
try { try {
boolean terminated = false; boolean terminated = false;

View File

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