diff --git a/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/NoReadFlowControlHandler.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/NoReadFlowControlHandler.java new file mode 100644 index 00000000..2d1326cf --- /dev/null +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/NoReadFlowControlHandler.java @@ -0,0 +1,34 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus + * Copyright (C) 2021-2024 FlorianMichael/EnZaXD and RK_01/RaphiMC + * Copyright (C) 2023-2024 contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package de.florianmichael.viafabricplus.protocoltranslator.netty; + +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.flow.FlowControlHandler; + +public class NoReadFlowControlHandler extends FlowControlHandler { + + @Override + public void read(ChannelHandlerContext ctx) throws Exception { + if (ctx.channel().config().isAutoRead()) { + super.read(ctx); + } + } + +} \ No newline at end of file diff --git a/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java index 11951123..93306608 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java @@ -31,6 +31,8 @@ import net.raphimc.vialoader.netty.VLLegacyPipeline; public class ViaFabricPlusVLLegacyPipeline extends VLLegacyPipeline { + public static final String VIA_FLOW_CONTROL = "via-flow-control"; + public static final String VIABEDROCK_COMPRESSION_HANDLER_NAME = "viabedrock-compression"; public static final String VIABEDROCK_ENCRYPTION_HANDLER_NAME = "viabedrock-encryption"; public static final String VIABEDROCK_PING_ENCAPSULATION_HANDLER_NAME = "viabedrock-ping-encapsulation"; @@ -43,6 +45,8 @@ public class ViaFabricPlusVLLegacyPipeline extends VLLegacyPipeline { public void handlerAdded(ChannelHandlerContext ctx) { super.handlerAdded(ctx); + ctx.pipeline().addAfter(VIA_DECODER_NAME, VIA_FLOW_CONTROL, new NoReadFlowControlHandler()); + this.user.getProtocolInfo().getPipeline().add(VFPProtocol.INSTANCE); }