From a2f5121e2fcd033aaaf584fea0b3bf3ac9efcd3c Mon Sep 17 00:00:00 2001 From: ishland Date: Sat, 9 Dec 2023 23:07:59 +0800 Subject: [PATCH] fix: ignore sync requests when multichannel is not active Fixes players stuck in infinite loading in some cases --- .../connection/RakNetSimpleMultiChannelCodec.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/ishland/raknetify/common/connection/RakNetSimpleMultiChannelCodec.java b/common/src/main/java/com/ishland/raknetify/common/connection/RakNetSimpleMultiChannelCodec.java index d4da804..7e23b3d 100644 --- a/common/src/main/java/com/ishland/raknetify/common/connection/RakNetSimpleMultiChannelCodec.java +++ b/common/src/main/java/com/ishland/raknetify/common/connection/RakNetSimpleMultiChannelCodec.java @@ -125,11 +125,13 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) promise.trySuccess(); return; } - if (msg == SynchronizationLayer.SYNC_REQUEST_OBJECT && this.isMultichannelEnabled) { - if (Constants.DEBUG) System.out.println("Raknetify: [MultiChannellingDataCodec] Stopped multichannel"); - this.isMultichannelEnabled = false; - super.write(ctx, msg, promise); - return; + if (msg == SynchronizationLayer.SYNC_REQUEST_OBJECT) { + if (this.isMultichannelEnabled) { + if (Constants.DEBUG) System.out.println("Raknetify: [MultiChannellingDataCodec] Stopped multichannel"); + this.isMultichannelEnabled = false; + super.write(ctx, msg, promise); + } + return; // discard sync request when multichannel is not active } if (msg instanceof ByteBuf buf && buf.isReadable()) {