3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-26 00:00:55 +01:00

Log server backpressure

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-12-27 18:36:54 -05:00
Ursprung 2a1e83902d
Commit dc7ab0f7f5

Datei anzeigen

@ -37,6 +37,8 @@ import org.apache.logging.log4j.Logger;
public class BackendPlaySessionHandler implements MinecraftSessionHandler { public class BackendPlaySessionHandler implements MinecraftSessionHandler {
private static final Logger logger = LogManager.getLogger(BackendPlaySessionHandler.class); private static final Logger logger = LogManager.getLogger(BackendPlaySessionHandler.class);
private static final boolean BACKPRESSURE_LOG = Boolean
.getBoolean("velocity.log-server-backpressure");
private final VelocityServer server; private final VelocityServer server;
private final VelocityServerConnection serverConn; private final VelocityServerConnection serverConn;
private final ClientPlaySessionHandler playerSessionHandler; private final ClientPlaySessionHandler playerSessionHandler;
@ -290,6 +292,15 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
public void writabilityChanged() { public void writabilityChanged() {
Channel serverChan = serverConn.ensureConnected().getChannel(); Channel serverChan = serverConn.ensureConnected().getChannel();
boolean writable = serverChan.isWritable(); boolean writable = serverChan.isWritable();
if (BACKPRESSURE_LOG) {
if (writable) {
logger.info("{} is not writable, not auto-reading player connection data", this.serverConn);
} else {
logger.info("{} is writable, will auto-read player connection data", this.serverConn);
}
}
playerConnection.setAutoReading(writable); playerConnection.setAutoReading(writable);
} }
} }