From 6c8b818d890e9e0ce4bc5e3128249bb9e62c0b23 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 15 Jun 2014 14:00:45 +0200 Subject: [PATCH] * User handling - Fixed a recently added bug and added some debug messages. --- Mage.Server/src/main/java/mage/server/User.java | 5 +++++ Mage.Server/src/main/java/mage/server/UserManager.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/User.java b/Mage.Server/src/main/java/mage/server/User.java index 312a582a39..b09c98e59b 100644 --- a/Mage.Server/src/main/java/mage/server/User.java +++ b/Mage.Server/src/main/java/mage/server/User.java @@ -327,18 +327,23 @@ public class User { } public void kill(DisconnectReason reason) { + logger.debug("start user kill"); for (GameSession gameSession: gameSessions.values()) { gameSession.kill(); } + logger.debug("user kill after game"); for (DraftSession draftSession: draftSessions.values()) { draftSession.setKilled(); } + logger.debug("user kill after draft"); for (TournamentSession tournamentSession: tournamentSessions.values()) { tournamentSession.setKilled(); } + logger.debug("user kill after tournament"); for (Entry entry: tables.entrySet()) { TableManager.getInstance().leaveTable(userId, entry.getValue().getId()); } + logger.debug("user kill after table"); ChatManager.getInstance().removeUser(userId, reason); } diff --git a/Mage.Server/src/main/java/mage/server/UserManager.java b/Mage.Server/src/main/java/mage/server/UserManager.java index ced0f76f45..ae803cff1d 100644 --- a/Mage.Server/src/main/java/mage/server/UserManager.java +++ b/Mage.Server/src/main/java/mage/server/UserManager.java @@ -130,7 +130,7 @@ public class UserManager { .append(" sessionId: ").append(user.getSessionId()) .append(" Reason: ").append(reason.toString())); ChatManager.getInstance().removeUser(userId, reason); - users.get(userId).kill(reason); + user.kill(reason); users.remove(userId); } else { logger.warn(new StringBuilder("Trying to remove userId: ").append(userId).append(" but user does not exist.")); @@ -165,7 +165,7 @@ public class UserManager { if (user.isExpired(expired.getTime())) { logger.info(new StringBuilder(user.getName()).append(": session expired userId: ").append(user.getId()) .append(" Host: ").append(user.getHost())); - SessionManager.getInstance().getSession(user.getSessionId()).kill(DisconnectReason.SessionExpired); + removeUser(user.getId(), DisconnectReason.SessionExpired); } } logger.debug("checkExpired - end");