Flush queued packets to the client in case we can't write

This commit is contained in:
Andrew Steinborn
2019-11-17 14:52:12 -05:00
parent 3eeea8e8f8
commit 8725178d6d

View File

@@ -274,9 +274,15 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
@Override
public void writabilityChanged() {
boolean writable = player.getConnection().getChannel().isWritable();
if (!writable) {
// We might have packets queued for the server, so flush them now to free up memory.
player.getConnection().flush();
}
VelocityServerConnection serverConn = player.getConnectedServer();
if (serverConn != null) {
boolean writable = player.getConnection().getChannel().isWritable();
MinecraftConnection smc = serverConn.getConnection();
if (smc != null) {
smc.setAutoReading(writable);