diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index 1e5127dd9e..018e6b4a1a 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -374,11 +374,9 @@ public class Session { call.setMessageId(messageId++); callbackHandler.handleCallbackOneway(new Callback(call)); } catch (HandleCallbackException ex) { - // ex.printStackTrace(); UserManager.instance.getUser(userId).ifPresent(user -> { - logger.warn("SESSION CALLBACK EXCEPTION - " + user.getName() + " userId " + userId); - logger.warn(" - method: " + call.getMethod()); - logger.warn(" - cause: " + getBasicCause(ex).toString()); + user.setUserState(User.UserState.Disconnected); + logger.warn("SESSION CALLBACK EXCEPTION - " + user.getName() + " userId " + userId + " - cause: " + getBasicCause(ex).toString()); logger.trace("Stack trace:", ex); SessionManager.instance.disconnect(sessionId, LostConnection); }); diff --git a/Mage.Server/src/main/java/mage/server/User.java b/Mage.Server/src/main/java/mage/server/User.java index 817ad3b313..985b8fc708 100644 --- a/Mage.Server/src/main/java/mage/server/User.java +++ b/Mage.Server/src/main/java/mage/server/User.java @@ -159,15 +159,15 @@ public class User { public void setSessionId(String sessionId) { this.sessionId = sessionId; if (sessionId.isEmpty()) { - userState = UserState.Disconnected; + setUserState(UserState.Disconnected); lostConnection(); logger.trace("USER - lost connection: " + userName + " id: " + userId); } else if (userState == UserState.Created) { - userState = UserState.Connected; + setUserState(UserState.Connected); logger.trace("USER - created: " + userName + " id: " + userId); } else { - userState = UserState.Connected; + setUserState(UserState.Connected); reconnect(); logger.trace("USER - reconnected: " + userName + " id: " + userId); } @@ -339,7 +339,7 @@ public class User { } lastActivity = new Date(); if (userState == UserState.Disconnected) { // this can happen if user reconnects very fast after disconnect - userState = UserState.Connected; + setUserState(UserState.Connected); } } diff --git a/Mage/src/main/java/mage/MageObjectReference.java b/Mage/src/main/java/mage/MageObjectReference.java index 0e04688fc4..0c4cde8808 100644 --- a/Mage/src/main/java/mage/MageObjectReference.java +++ b/Mage/src/main/java/mage/MageObjectReference.java @@ -81,9 +81,9 @@ public class MageObjectReference implements Comparable, Ser if (game.getPlayerList().contains(sourceId)) { this.zoneChangeCounter = 0; } else { - logger.error("The provided sourceId is not connected to an object in the game id:" + sourceId); + logger.error("The provided sourceId is not connected to an object in the game id: " + sourceId); for (StackObject stackObject : game.getStack()) { - logger.error("StackObject: " + stackObject.getId() + " sourceId" + stackObject.getSourceId() + " name" + stackObject.getName()); + logger.error("StackObject: " + stackObject.getId() + " sourceId " + stackObject.getSourceId() + " name " + stackObject.getName()); } mageObject = game.getLastKnownInformation(sourceId, Zone.STACK); if (mageObject != null) {