mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
server: improved performance and stability with broken AI and human games, e.g. less memory leaks and out of memory errors with AI (related to #11285, #5023);
This commit is contained in:
parent
5626079be9
commit
dfb84b09f3
5 changed files with 14 additions and 17 deletions
|
|
@ -897,7 +897,9 @@ public abstract class GameImpl implements Game {
|
|||
numLosers++;
|
||||
}
|
||||
}
|
||||
if (remainingPlayers <= 1 || numLosers >= state.getPlayers().size() - 1) {
|
||||
boolean noMorePlayers = remainingPlayers <= 1 || numLosers >= state.getPlayers().size() - 1;
|
||||
// stop on no more players or on stopped game sim thread
|
||||
if (noMorePlayers || Thread.currentThread().isInterrupted()) {
|
||||
end();
|
||||
if (remainingPlayers == 0 && logger.isDebugEnabled()) {
|
||||
logger.debug("DRAW for gameId: " + getId());
|
||||
|
|
|
|||
|
|
@ -2834,8 +2834,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canRespond() { // abort is checked here to get out of player requests (as example: after disconnect)
|
||||
return isInGame() && !abort;
|
||||
public boolean canRespond() {
|
||||
// abort is checked here to get out of player requests (as example: after disconnect)
|
||||
// thread is checked here to get out of AI game simulations or close by third party tools
|
||||
return isInGame() && !abort && !Thread.currentThread().isInterrupted();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue