mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
* Some minor fixed and log changes.
This commit is contained in:
parent
9a21b55d39
commit
60cc3a7622
9 changed files with 90 additions and 46 deletions
|
|
@ -636,7 +636,8 @@ public class MageServerImpl implements MageServer {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
logger.error("table not found : " + tableId);
|
||||
// this can happen if a game ends and a player quits XMage or a match nearly at the same time as the game ends
|
||||
logger.trace("table not found : " + tableId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1119,12 +1120,12 @@ public class MageServerImpl implements MageServer {
|
|||
public void toggleActivation(final String sessionId, final String userName) throws MageException {
|
||||
execute("toggleActivation", sessionId, ()
|
||||
-> UserManager.instance.getUserByName(userName).ifPresent(user
|
||||
-> {
|
||||
user.setActive(!user.isActive());
|
||||
if (!user.isActive() && user.isConnected()) {
|
||||
SessionManager.instance.disconnectUser(sessionId, user.getSessionId());
|
||||
}
|
||||
}));
|
||||
-> {
|
||||
user.setActive(!user.isActive());
|
||||
if (!user.isActive() && user.isConnected()) {
|
||||
SessionManager.instance.disconnectUser(sessionId, user.getSessionId());
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1159,8 +1160,8 @@ public class MageServerImpl implements MageServer {
|
|||
if (title != null && message != null) {
|
||||
execute("sendFeedbackMessage", sessionId, ()
|
||||
-> SessionManager.instance.getSession(sessionId).ifPresent(
|
||||
session -> FeedbackServiceImpl.instance.feedback(username, title, type, message, email, session.getHost())
|
||||
));
|
||||
session -> FeedbackServiceImpl.instance.feedback(username, title, type, message, email, session.getHost())
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@
|
|||
*/
|
||||
package mage.server;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import mage.MageException;
|
||||
import mage.constants.Constants;
|
||||
import mage.interfaces.callback.ClientCallback;
|
||||
|
|
@ -44,12 +49,6 @@ import org.jboss.remoting.callback.Callback;
|
|||
import org.jboss.remoting.callback.HandleCallbackException;
|
||||
import org.jboss.remoting.callback.InvokerCallbackHandler;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -218,8 +217,8 @@ public class Session {
|
|||
if (authorizedUser.lockedUntil.compareTo(Calendar.getInstance().getTime()) > 0) {
|
||||
return "Your profile is deactivated until " + SystemUtil.dateFormat.format(authorizedUser.lockedUntil);
|
||||
} else {
|
||||
UserManager.instance.createUser(userName, host, authorizedUser).ifPresent(user ->
|
||||
user.setLockedUntil(null)
|
||||
UserManager.instance.createUser(userName, host, authorizedUser).ifPresent(user
|
||||
-> user.setLockedUntil(null)
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -263,7 +262,6 @@ public class Session {
|
|||
ChatManager.instance.sendReconnectMessage(userId);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
|
@ -337,7 +335,7 @@ public class Session {
|
|||
lockSet = true;
|
||||
logger.debug("SESSION LOCK SET sessionId: " + sessionId);
|
||||
} else {
|
||||
logger.error("CAN'T GET LOCK - userId: " + userId + " hold count: " + lock.getHoldCount());
|
||||
logger.warn("CAN'T GET LOCK - userId: " + userId + " hold count: " + lock.getHoldCount());
|
||||
}
|
||||
Optional<User> _user = UserManager.instance.getUser(userId);
|
||||
if (!_user.isPresent()) {
|
||||
|
|
@ -393,7 +391,7 @@ public class Session {
|
|||
call.setMessageId(messageId++);
|
||||
callbackHandler.handleCallbackOneway(new Callback(call));
|
||||
} catch (HandleCallbackException ex) {
|
||||
ex.printStackTrace();
|
||||
// ex.printStackTrace();
|
||||
UserManager.instance.getUser(userId).ifPresent(user -> {
|
||||
logger.warn("SESSION CALLBACK EXCEPTION - " + user.getName() + " userId " + userId);
|
||||
logger.warn(" - method: " + call.getMethod());
|
||||
|
|
|
|||
|
|
@ -144,8 +144,10 @@ public enum SessionManager {
|
|||
case LostConnection: // user lost connection - session expires countdaoun starts
|
||||
session.userLostConnection();
|
||||
break;
|
||||
case ConnectingOtherInstance:
|
||||
break;
|
||||
default:
|
||||
logger.error("endSession: unexpected reason " + reason.toString() + " - sessionId: " + sessionId);
|
||||
logger.trace("endSession: unexpected reason " + reason.toString() + " - sessionId: " + sessionId);
|
||||
}
|
||||
} else {
|
||||
sessions.remove(sessionId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue