From 5a25e351b4153753fc1024605d76290169fdb12b Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Wed, 4 Aug 2021 23:01:28 -0400 Subject: [PATCH] Fix not forwarding channelReadComplete events in some cases --- .../proxy/protocol/netty/AutoReadHolderHandler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/AutoReadHolderHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/AutoReadHolderHandler.java index 7c457e164..9083f72a1 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/AutoReadHolderHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/AutoReadHolderHandler.java @@ -62,8 +62,12 @@ public class AutoReadHolderHandler extends ChannelDuplexHandler { @Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { - if (this.queuedMessages.isEmpty()) { - ctx.fireChannelReadComplete(); + if (ctx.channel().config().isAutoRead()) { + if (!this.queuedMessages.isEmpty()) { + this.drainQueuedMessages(ctx); // will also call fireChannelReadComplete() + } else { + ctx.fireChannelReadComplete(); + } } }