示例#1
0
 /** Safely disconnects this ClientHandler from the Server */
 public void disconnect() {
   try {
     pool.removeFromAllQueues(this);
     if (game != null) {
       game.endGame(false); // End the game the client was in.
     }
     reader.close();
     writer.close();
     client.close();
     System.out.println("[Server] Debug (ClientHandler) - Client has disconnected.");
     pool.removeClient(name);
     connected = false;
   } catch (IOException e) {
     e.printStackTrace();
   }
 }