From d10385fad2a3903cf9ab825a1b0d9aa41b841c57 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Sat, 28 Apr 2012 03:00:11 +0400 Subject: [PATCH] changed "already connected" state handling --- Mage.Common/src/mage/remote/Session.java | 1 + Mage.Server/src/main/java/mage/server/Session.java | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Mage.Common/src/mage/remote/Session.java b/Mage.Common/src/mage/remote/Session.java index 3b1657484b..9eb5d69192 100644 --- a/Mage.Common/src/mage/remote/Session.java +++ b/Mage.Common/src/mage/remote/Session.java @@ -267,6 +267,7 @@ public class Session { class CallbackHandler implements InvokerCallbackHandler { @Override public void handleCallback(Callback callback) throws HandleCallbackException { + logger.info("callback handler"); client.processCallback((ClientCallback)callback.getCallbackObject()); } } diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index d5a72b048f..0a025f3d73 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -75,8 +75,12 @@ public class Session { if (user.getHost().equals(host)) { if (user.getSessionId().isEmpty()) logger.info("Reconnecting session for " + userName); - else - throw new MageException("This machine is already connected"); + else { + //throw new MageException("This machine is already connected"); + //disconnect previous one + logger.info("Disconnecting another user instance: " + userName); + UserManager.getInstance().disconnect(user.getId()); + } } else { throw new MageException("User name already in use");