mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
Some minor user handling changes.
This commit is contained in:
parent
f80129a0ed
commit
720351c065
3 changed files with 8 additions and 10 deletions
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,9 +81,9 @@ public class MageObjectReference implements Comparable<MageObjectReference>, 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) {
|
||||
|
|
Loading…
Reference in a new issue