[Jrisk-cvs] SF.net SVN: domination-code:[2590] Domination/src/net/yura/domination/ engine/Risk.java
Brought to you by:
yuranet
|
From: <yu...@us...> - 2024-11-28 22:49:27
|
Revision: 2590
http://sourceforge.net/p/domination/code/2590
Author: yuranet
Date: 2024-11-28 22:49:25 +0000 (Thu, 28 Nov 2024)
Log Message:
-----------
wait for commands to process before closing game to avoid errors
Modified Paths:
--------------
Domination/src/net/yura/domination/engine/Risk.java
Modified: Domination/src/net/yura/domination/engine/Risk.java
===================================================================
--- Domination/src/net/yura/domination/engine/Risk.java 2024-11-28 12:23:15 UTC (rev 2589)
+++ Domination/src/net/yura/domination/engine/Risk.java 2024-11-28 22:49:25 UTC (rev 2590)
@@ -2362,13 +2362,19 @@
}
public void disconnected() {
-
//System.out.print("Got kicked off the server!\n");
- closeGame();
+ try {
+ // if close the game, we may be right in the middle of processing a game command right now
+ parserAndWait("closegame");
+ }
+ catch (InterruptedException e) {
+ // this should never happen, but just in case, we want to shutdown the game
+ logger.log(Level.WARNING, "InterruptedException during disconnected closegame", e);
+ closeGame();
+ getInput();
+ }
controller.sendMessage(resb.getString( "core.kicked.error.disconnected"),false,false);
-
- getInput();
}
private void updateBattleState() {
@@ -2710,7 +2716,7 @@
controller.showMessageDialog(a);
}
- private synchronized void closeGame() {
+ private void closeGame() {
boolean createNewAddress = false;
|