From 7c33dda11b2c80002239e88929498f4a4d7aaf41 Mon Sep 17 00:00:00 2001 From: s809 <43530948+s809@users.noreply.github.com> Date: Tue, 16 Apr 2024 20:32:50 +0500 Subject: [PATCH] Add FlushConsolidationHandler --- .../core/network/protocol/netty/NettyChannelInitializer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/network/protocol/netty/NettyChannelInitializer.java b/core/src/main/java/com/seibel/distanthorizons/core/network/protocol/netty/NettyChannelInitializer.java index d9946103d..aea4da707 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/network/protocol/netty/NettyChannelInitializer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/network/protocol/netty/NettyChannelInitializer.java @@ -27,6 +27,7 @@ import io.netty.channel.*; import io.netty.channel.socket.SocketChannel; import io.netty.handler.codec.LengthFieldBasedFrameDecoder; import io.netty.handler.codec.LengthFieldPrepender; +import io.netty.handler.flush.FlushConsolidationHandler; import org.jetbrains.annotations.NotNull; /** Used when creating a network channel */ @@ -48,6 +49,7 @@ public class NettyChannelInitializer extends ChannelInitializer ChannelPipeline pipeline = socketChannel.pipeline(); // Encoder + pipeline.addLast(new FlushConsolidationHandler(FlushConsolidationHandler.DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES, true)); pipeline.addLast(new LengthFieldPrepender(Integer.BYTES)); pipeline.addLast(new MessageEncoder<>(NettyMessageRegistry.INSTANCE, NettyMessage.class)); pipeline.addLast(new NettyOutboundExceptionRouter());