mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Some minor changes to server.
This commit is contained in:
parent
350897b0e2
commit
ae0417bf5c
3 changed files with 23 additions and 8 deletions
|
|
@ -37,6 +37,7 @@ import java.util.concurrent.ExecutorService;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import mage.server.User.UserState;
|
||||
import mage.server.util.ThreadExecutor;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -178,9 +179,8 @@ public class UserManager {
|
|||
List<User> usersToCheck = new ArrayList<>();
|
||||
usersToCheck.addAll(users.values());
|
||||
for (User user : usersToCheck) {
|
||||
if (user.isExpired(calendar.getTime())) {
|
||||
logger.info(new StringBuilder(user.getName()).append(": session expired userId: ").append(user.getId())
|
||||
.append(" Host: ").append(user.getHost()));
|
||||
if (!user.getUserState().equals(UserState.Expired) && user.isExpired(calendar.getTime())) {
|
||||
logger.info(user.getName() + ": session expired userId: "+ user.getId() + " Host: " + user.getHost());
|
||||
removeUser(user.getId(), DisconnectReason.SessionExpired);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@ public class GameWorker implements Callable {
|
|||
|
||||
private static final Logger logger = Logger.getLogger(GameWorker.class);
|
||||
|
||||
private final GameCallback result;
|
||||
private final GameCallback gameController;
|
||||
private final Game game;
|
||||
private final UUID choosingPlayerId;
|
||||
|
||||
public GameWorker(Game game, UUID choosingPlayerId, GameCallback result) {
|
||||
public GameWorker(Game game, UUID choosingPlayerId, GameCallback gameController) {
|
||||
this.game = game;
|
||||
this.choosingPlayerId = choosingPlayerId;
|
||||
this.result = result;
|
||||
this.gameController = gameController;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -58,7 +58,7 @@ public class GameWorker implements Callable {
|
|||
logger.debug("GameWorker started gameId "+ game.getId());
|
||||
game.start(choosingPlayerId);
|
||||
game.fireUpdatePlayersEvent();
|
||||
result.gameResult(game.getWinner());
|
||||
gameController.gameResult(game.getWinner());
|
||||
game.cleanUp();
|
||||
} catch (MageException ex) {
|
||||
logger.fatal("GameWorker mage error [" + game.getId() + "]" +ex, ex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue