mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
server: improved logs for some use cases (related to #11572)
This commit is contained in:
parent
fac5f8c752
commit
e79f562f4a
4 changed files with 20 additions and 8 deletions
|
|
@ -211,16 +211,18 @@ public class HumanPlayer extends PlayerImpl {
|
|||
// game frozen, possible reasons:
|
||||
// * ANOTHER player lost connection and GAME thread trying to send data to him
|
||||
// * current player send answer, but lost connect after it
|
||||
// * game thread stops and lost
|
||||
String possibleReason;
|
||||
if (response.getActiveAction() == null) {
|
||||
possibleReason = "maybe connection problem with another player/watcher";
|
||||
} else {
|
||||
possibleReason = "something wrong with your priority on " + response.getActiveAction();
|
||||
}
|
||||
logger.warn(String.format("Game frozen in waitResponseOpen for %d secs: current user %s, %s",
|
||||
logger.warn(String.format("Game frozen in waitResponseOpen for %d secs. User: %s; reason: %s; game: %s",
|
||||
RESPONSE_WAITING_CHECK_MS * currentTimesWaiting / 1000,
|
||||
this.getName(),
|
||||
possibleReason
|
||||
possibleReason,
|
||||
response.getActiveGameInfo()
|
||||
));
|
||||
return false;
|
||||
}
|
||||
|
|
@ -308,7 +310,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
while (loop) {
|
||||
// start waiting for next answer
|
||||
response.clear();
|
||||
response.setActiveAction(DebugUtil.getMethodNameWithSource(2));
|
||||
response.setActiveAction(game, DebugUtil.getMethodNameWithSource(2));
|
||||
game.resumeTimer(getTurnControlledBy());
|
||||
responseOpenedForAnswer = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.player.human;
|
||||
|
||||
import mage.constants.ManaType;
|
||||
import mage.game.Game;
|
||||
import mage.util.Copyable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -20,7 +21,8 @@ import java.util.UUID;
|
|||
*/
|
||||
public class PlayerResponse implements Serializable, Copyable<PlayerResponse> {
|
||||
|
||||
private String activeAction; // for debug information
|
||||
private String activeAction; // for logs/debug information
|
||||
private String activeGameInfo; // for logs/debug info
|
||||
|
||||
private String responseString;
|
||||
private UUID responseUUID;
|
||||
|
|
@ -64,6 +66,7 @@ public class PlayerResponse implements Serializable, Copyable<PlayerResponse> {
|
|||
|
||||
public void copyFrom(final PlayerResponse response) {
|
||||
this.activeAction = response.activeAction;
|
||||
this.activeGameInfo = response.activeGameInfo;
|
||||
this.responseString = response.responseString;
|
||||
this.responseUUID = response.responseUUID;
|
||||
this.responseBoolean = response.responseBoolean;
|
||||
|
|
@ -76,6 +79,7 @@ public class PlayerResponse implements Serializable, Copyable<PlayerResponse> {
|
|||
|
||||
public void clear() {
|
||||
this.activeAction = null;
|
||||
this.activeGameInfo = null;
|
||||
this.responseString = null;
|
||||
this.responseUUID = null;
|
||||
this.responseBoolean = null;
|
||||
|
|
@ -90,8 +94,13 @@ public class PlayerResponse implements Serializable, Copyable<PlayerResponse> {
|
|||
return this.activeAction;
|
||||
}
|
||||
|
||||
public void setActiveAction(String activeAction) {
|
||||
public String getActiveGameInfo() {
|
||||
return this.activeGameInfo;
|
||||
}
|
||||
|
||||
public void setActiveAction(Game game, String activeAction) {
|
||||
this.activeAction = activeAction;
|
||||
this.activeGameInfo = game.getId() + ", " + game;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue