Make sure to issue a backpressure-solving flush on a future iteration of the event loop

Thanks to @Spottedleaf for finding this issue.
This commit is contained in:
Andrew Steinborn
2021-08-04 23:37:27 -04:00
parent 5a25e351b4
commit eb989b5011

View File

@@ -334,8 +334,11 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
boolean writable = player.getConnection().getChannel().isWritable();
if (!writable) {
// We might have packets queued from the server, so flush them now to free up memory.
player.getConnection().flush();
// We might have packets queued from the server, so flush them now to free up memory. Make
// sure to do it on a future invocation of the event loop, otherwise while the issue will
// fix itself, we'll still disable auto-reading and instead of backpressure resolution, we
// get client timeouts.
player.getConnection().eventLoop().execute(() -> player.getConnection().flush());
}
VelocityServerConnection serverConn = player.getConnectedServer();