From dc7ab0f7f57ea08632a473b3e7426665fef678ee Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 27 Dec 2020 18:36:54 -0500 Subject: [PATCH] Log server backpressure --- .../connection/backend/BackendPlaySessionHandler.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java index 476460dc1..6dab7d8a5 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java @@ -37,6 +37,8 @@ import org.apache.logging.log4j.Logger; public class BackendPlaySessionHandler implements MinecraftSessionHandler { 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 VelocityServerConnection serverConn; private final ClientPlaySessionHandler playerSessionHandler; @@ -290,6 +292,15 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler { public void writabilityChanged() { Channel serverChan = serverConn.ensureConnected().getChannel(); 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); } }