changed "already connected" state handling

This commit is contained in:
magenoxx 2012-04-28 03:00:11 +04:00
parent b43492ba19
commit d10385fad2
2 changed files with 7 additions and 2 deletions

View file

@ -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());
}
}

View file

@ -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");