More debug stats

This commit is contained in:
Anuken
2021-12-21 10:33:09 -05:00
parent a093ba5511
commit 2dfa238ff3
2 changed files with 16 additions and 9 deletions

View File

@@ -578,21 +578,25 @@ public class NetServer implements ApplicationListener{
(player.isAdded() ? 4 : 0) |
(player.con.hasBegunConnecting ? 8 : 0);
Call.debugStatusClient(player.con, flags);
Call.debugStatusClientUnreliable(player.con, flags);
Call.debugStatusClient(player.con, flags, player.con.lastReceivedClientSnapshot, player.con.snapshotsSent);
Call.debugStatusClientUnreliable(player.con, flags, player.con.lastReceivedClientSnapshot, player.con.snapshotsSent);
}
@Remote(variants = Variant.both, priority = PacketPriority.high)
public static void debugStatusClient(int value){
Log.info("[RELIABLE] Debug status received. disconnected = @, connected = @, added = @, begunConnecting = @",
(value & 1) != 0, (value & 2) != 0, (value & 4) != 0, (value & 8) != 0
);
public static void debugStatusClient(int value, int lastClientSnapshot, int snapshotsSent){
logClientStatus(true, value, lastClientSnapshot, snapshotsSent);
}
@Remote(variants = Variant.both, priority = PacketPriority.high, unreliable = true)
public static void debugStatusClientUnreliable(int value){
Log.info("[UNRELIABLE] Debug status received. disconnected = @, connected = @, added = @, begunConnecting = @",
(value & 1) != 0, (value & 2) != 0, (value & 4) != 0, (value & 8) != 0
public static void debugStatusClientUnreliable(int value, int lastClientSnapshot, int snapshotsSent){
logClientStatus(false, value, lastClientSnapshot, snapshotsSent);
}
static void logClientStatus(boolean reliable, int value, int lastClientSnapshot, int snapshotsSent){
Log.info("@ Debug status received. disconnected = @, connected = @, added = @, begunConnecting = @ lastClientSnapshot = @, snapshotsSent = @",
reliable ? "[RELIABLE]" : "[UNRELIABLE]",
(value & 1) != 0, (value & 2) != 0, (value & 4) != 0, (value & 8) != 0,
lastClientSnapshot, snapshotsSent
);
}
@@ -959,6 +963,7 @@ public class NetServer implements ApplicationListener{
Call.entitySnapshot(player.con, (short)sent, syncStream.toByteArray());
}
player.con.snapshotsSent ++;
}
String fixName(String name){

View File

@@ -22,6 +22,8 @@ public abstract class NetConnection{
public long connectTime = Time.millis();
/** ID of last received client snapshot. */
public int lastReceivedClientSnapshot = -1;
/** Count of snapshots sent from server. */
public int snapshotsSent;
/** Timestamp of last received snapshot. */
public long lastReceivedClientTime;
/** Build requests that have been recently rejected. This is cleared every snapshot. */