Cleaned up client disconnect scenario.
This commit is contained in:
parent
4e01673bf8
commit
ee6d7a00cb
|
@ -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;
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue