Terminated the game server socket when click exit lobby button

- the whole server thread should be terminated instead. To be fixed in the future.

#story[1047] #issue[28]
This commit is contained in:
Haoming Yin
2017-07-13 17:51:25 +12:00
parent 8090cd7985
commit 6ec8b0c3c5
4 changed files with 39 additions and 9 deletions
@@ -256,8 +256,9 @@ public class GameServerThread implements Runnable, Observer, ClientConnectionDel
}
acceptConnection();
acceptConnection();
// acceptConnection();
// acceptConnection();
System.out.println("well, hit here now");
for (Player player : GameState.getPlayers()) {
System.out.println(player);
@@ -399,4 +400,13 @@ public class GameServerThread implements Runnable, Observer, ClientConnectionDel
// }
//}
public void terminateGame() {
try {
//TODO: for now, I just close the socket, but i think we should terminate the whole thread instead. -hyi25 13 July
server.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -9,7 +9,8 @@ public enum GameStages {
LOBBYING(0),
PRE_RACE(1),
RACING(2),
FINISHED(3);
FINISHED(3),
CANCELLED(4);
private long code;