From 9ae3efd41ff72a61c7bb6de3024fb7c9de861c9e Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Sun, 30 Apr 2023 17:48:20 +0200 Subject: [PATCH] Changed position of auto read disabling --- .../viaproxy/proxy/proxy2server/Proxy2ServerHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/raphimc/viaproxy/proxy/proxy2server/Proxy2ServerHandler.java b/src/main/java/net/raphimc/viaproxy/proxy/proxy2server/Proxy2ServerHandler.java index 8e53490..f3f9f35 100644 --- a/src/main/java/net/raphimc/viaproxy/proxy/proxy2server/Proxy2ServerHandler.java +++ b/src/main/java/net/raphimc/viaproxy/proxy/proxy2server/Proxy2ServerHandler.java @@ -138,26 +138,26 @@ public class Proxy2ServerHandler extends SimpleChannelInboundHandler { private void handleLoginSuccess(final S2CLoginSuccessPacket1_7 packet) { if (this.proxyConnection.getClientVersion().isNewerThanOrEqualTo(VersionEnum.r1_8)) { if (Options.COMPRESSION_THRESHOLD > -1 && this.proxyConnection.getC2P().attr(MCPipeline.COMPRESSION_THRESHOLD_ATTRIBUTE_KEY).get() == -1) { + this.proxyConnection.getChannel().config().setAutoRead(false); this.proxyConnection.getC2P().writeAndFlush(new S2CLoginCompressionPacket(Options.COMPRESSION_THRESHOLD)).addListeners(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE, (ChannelFutureListener) f -> { if (f.isSuccess()) { this.proxyConnection.getC2P().attr(MCPipeline.COMPRESSION_THRESHOLD_ATTRIBUTE_KEY).set(Options.COMPRESSION_THRESHOLD); this.proxyConnection.getChannel().config().setAutoRead(true); } }); - this.proxyConnection.getChannel().config().setAutoRead(false); } } this.proxyConnection.setGameProfile(new GameProfile(packet.uuid, packet.name)); - Logger.u_info("connect", this.proxyConnection.getC2P().remoteAddress(), this.proxyConnection.getGameProfile(), "Connected successfully! Switching to PLAY state"); + + this.proxyConnection.getChannel().config().setAutoRead(false); this.proxyConnection.getC2P().writeAndFlush(packet).addListeners(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE, (ChannelFutureListener) f -> { if (f.isSuccess()) { this.proxyConnection.setConnectionState(ConnectionState.PLAY); this.proxyConnection.getChannel().config().setAutoRead(true); } }); - this.proxyConnection.getChannel().config().setAutoRead(false); } private void handleLoginCompression(final S2CLoginCompressionPacket packet) {