mirror of
https://github.com/correl/mage.git
synced 2024-12-01 11:09:56 +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++);
|
call.setMessageId(messageId++);
|
||||||
callbackHandler.handleCallbackOneway(new Callback(call));
|
callbackHandler.handleCallbackOneway(new Callback(call));
|
||||||
} catch (HandleCallbackException ex) {
|
} catch (HandleCallbackException ex) {
|
||||||
// ex.printStackTrace();
|
|
||||||
UserManager.instance.getUser(userId).ifPresent(user -> {
|
UserManager.instance.getUser(userId).ifPresent(user -> {
|
||||||
logger.warn("SESSION CALLBACK EXCEPTION - " + user.getName() + " userId " + userId);
|
user.setUserState(User.UserState.Disconnected);
|
||||||
logger.warn(" - method: " + call.getMethod());
|
logger.warn("SESSION CALLBACK EXCEPTION - " + user.getName() + " userId " + userId + " - cause: " + getBasicCause(ex).toString());
|
||||||
logger.warn(" - cause: " + getBasicCause(ex).toString());
|
|
||||||
logger.trace("Stack trace:", ex);
|
logger.trace("Stack trace:", ex);
|
||||||
SessionManager.instance.disconnect(sessionId, LostConnection);
|
SessionManager.instance.disconnect(sessionId, LostConnection);
|
||||||
});
|
});
|
||||||
|
|
|
@ -159,15 +159,15 @@ public class User {
|
||||||
public void setSessionId(String sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
if (sessionId.isEmpty()) {
|
if (sessionId.isEmpty()) {
|
||||||
userState = UserState.Disconnected;
|
setUserState(UserState.Disconnected);
|
||||||
lostConnection();
|
lostConnection();
|
||||||
logger.trace("USER - lost connection: " + userName + " id: " + userId);
|
logger.trace("USER - lost connection: " + userName + " id: " + userId);
|
||||||
|
|
||||||
} else if (userState == UserState.Created) {
|
} else if (userState == UserState.Created) {
|
||||||
userState = UserState.Connected;
|
setUserState(UserState.Connected);
|
||||||
logger.trace("USER - created: " + userName + " id: " + userId);
|
logger.trace("USER - created: " + userName + " id: " + userId);
|
||||||
} else {
|
} else {
|
||||||
userState = UserState.Connected;
|
setUserState(UserState.Connected);
|
||||||
reconnect();
|
reconnect();
|
||||||
logger.trace("USER - reconnected: " + userName + " id: " + userId);
|
logger.trace("USER - reconnected: " + userName + " id: " + userId);
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ public class User {
|
||||||
}
|
}
|
||||||
lastActivity = new Date();
|
lastActivity = new Date();
|
||||||
if (userState == UserState.Disconnected) { // this can happen if user reconnects very fast after disconnect
|
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)) {
|
if (game.getPlayerList().contains(sourceId)) {
|
||||||
this.zoneChangeCounter = 0;
|
this.zoneChangeCounter = 0;
|
||||||
} else {
|
} 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()) {
|
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);
|
mageObject = game.getLastKnownInformation(sourceId, Zone.STACK);
|
||||||
if (mageObject != null) {
|
if (mageObject != null) {
|
||||||
|
|
Loading…
Reference in a new issue