diff --git a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java b/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java index 27ae34e0f6f..5cf78d2879f 100644 --- a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java +++ b/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java @@ -19,6 +19,7 @@ import mage.interfaces.callback.ClientCallback; import mage.interfaces.callback.ClientCallbackType; import mage.remote.ActionData; import mage.remote.Session; +import mage.util.DebugUtil; import mage.view.*; import mage.view.ChatMessage.MessageType; import org.apache.log4j.Logger; @@ -34,8 +35,6 @@ public class CallbackClientImpl implements CallbackClient { private static final Logger logger = Logger.getLogger(CallbackClientImpl.class); - private static final boolean DEBUG_CALLBACK_MESSAGES_LOG = false; // show all callback messages (server commands) - private final MageFrame frame; private final Map lastMessages; private final Map firstGameData; @@ -71,7 +70,7 @@ public class CallbackClientImpl implements CallbackClient { // all GUI related code must be executed in swing thread SwingUtilities.invokeLater(() -> { try { - if (DEBUG_CALLBACK_MESSAGES_LOG) { + if (DebugUtil.NETWORK_SHOW_CLIENT_CALLBACK_MESSAGES_LOG) { logger.info("message " + callback.getMessageId() + " - " + callback.getMethod().getType() + " - " + callback.getMethod()); } diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index 1fd739e0a6f..e6d8bfa2d70 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -211,16 +211,18 @@ public class HumanPlayer extends PlayerImpl { // game frozen, possible reasons: // * ANOTHER player lost connection and GAME thread trying to send data to him // * current player send answer, but lost connect after it + // * game thread stops and lost String possibleReason; if (response.getActiveAction() == null) { possibleReason = "maybe connection problem with another player/watcher"; } else { possibleReason = "something wrong with your priority on " + response.getActiveAction(); } - logger.warn(String.format("Game frozen in waitResponseOpen for %d secs: current user %s, %s", + logger.warn(String.format("Game frozen in waitResponseOpen for %d secs. User: %s; reason: %s; game: %s", RESPONSE_WAITING_CHECK_MS * currentTimesWaiting / 1000, this.getName(), - possibleReason + possibleReason, + response.getActiveGameInfo() )); return false; } @@ -308,7 +310,7 @@ public class HumanPlayer extends PlayerImpl { while (loop) { // start waiting for next answer response.clear(); - response.setActiveAction(DebugUtil.getMethodNameWithSource(2)); + response.setActiveAction(game, DebugUtil.getMethodNameWithSource(2)); game.resumeTimer(getTurnControlledBy()); responseOpenedForAnswer = true; diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/PlayerResponse.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/PlayerResponse.java index 6fdbe396e08..a874bc8a06f 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/PlayerResponse.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/PlayerResponse.java @@ -1,6 +1,7 @@ package mage.player.human; import mage.constants.ManaType; +import mage.game.Game; import mage.util.Copyable; import java.io.Serializable; @@ -20,7 +21,8 @@ import java.util.UUID; */ public class PlayerResponse implements Serializable, Copyable { - private String activeAction; // for debug information + private String activeAction; // for logs/debug information + private String activeGameInfo; // for logs/debug info private String responseString; private UUID responseUUID; @@ -64,6 +66,7 @@ public class PlayerResponse implements Serializable, Copyable { public void copyFrom(final PlayerResponse response) { this.activeAction = response.activeAction; + this.activeGameInfo = response.activeGameInfo; this.responseString = response.responseString; this.responseUUID = response.responseUUID; this.responseBoolean = response.responseBoolean; @@ -76,6 +79,7 @@ public class PlayerResponse implements Serializable, Copyable { public void clear() { this.activeAction = null; + this.activeGameInfo = null; this.responseString = null; this.responseUUID = null; this.responseBoolean = null; @@ -90,8 +94,13 @@ public class PlayerResponse implements Serializable, Copyable { return this.activeAction; } - public void setActiveAction(String activeAction) { + public String getActiveGameInfo() { + return this.activeGameInfo; + } + + public void setActiveAction(Game game, String activeAction) { this.activeAction = activeAction; + this.activeGameInfo = game.getId() + ", " + game; } public String getString() { diff --git a/Mage/src/main/java/mage/util/DebugUtil.java b/Mage/src/main/java/mage/util/DebugUtil.java index e8242f0efe9..4f2cbfc888d 100644 --- a/Mage/src/main/java/mage/util/DebugUtil.java +++ b/Mage/src/main/java/mage/util/DebugUtil.java @@ -11,6 +11,8 @@ import java.lang.reflect.Method; */ public class DebugUtil { + public static boolean NETWORK_SHOW_CLIENT_CALLBACK_MESSAGES_LOG = false; // show all callback messages (server commands) + // cards basic (card panels) public static boolean GUI_CARD_DRAW_OUTER_BORDER = false; public static boolean GUI_CARD_DRAW_INNER_BORDER = false;