3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-06 00:00:47 +01:00

Add limited flush consolidation, if the remote server supports it.

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-11-17 11:14:56 -05:00
Ursprung ba8629ca0e
Commit 3eeea8e8f8
3 geänderte Dateien mit 18 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -124,6 +124,13 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
} }
} }
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
if (sessionHandler != null) {
sessionHandler.readCompleted();
}
}
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (ctx.channel().isActive()) { if (ctx.channel().isActive()) {

Datei anzeigen

@ -70,6 +70,10 @@ public interface MinecraftSessionHandler {
} }
default void readCompleted() {
}
default boolean handle(AvailableCommands commands) { default boolean handle(AvailableCommands commands) {
return false; return false;
} }

Datei anzeigen

@ -168,12 +168,17 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
if (packet instanceof PluginMessage) { if (packet instanceof PluginMessage) {
((PluginMessage) packet).retain(); ((PluginMessage) packet).retain();
} }
playerConnection.write(packet); playerConnection.delayedWrite(packet);
} }
@Override @Override
public void handleUnknown(ByteBuf buf) { public void handleUnknown(ByteBuf buf) {
playerConnection.write(buf.retain()); playerConnection.delayedWrite(buf.retain());
}
@Override
public void readCompleted() {
playerConnection.flush();
} }
@Override @Override