From ed4a80eb0bf53bb6b37b9f602316024e965299b6 Mon Sep 17 00:00:00 2001 From: Valentine <21033866+BoomEaro@users.noreply.github.com> Date: Sat, 8 Feb 2025 23:17:16 +0200 Subject: [PATCH] #3781: Fix eventLoopCallback --- .../bungee/connection/InitialHandler.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index b8542177..047e7129 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -899,19 +899,25 @@ public class InitialHandler extends PacketHandler implements PendingConnection // otherwise netty will schedule any pipeline related call by itself, this decreases performance private Callback eventLoopCallback(Callback callback) { - EventLoop eventLoop = ch.getHandle().eventLoop(); - return eventLoop.inEventLoop() ? (result, error) -> + return (result, error) -> { - if ( !ch.isClosing() ) + EventLoop eventLoop = ch.getHandle().eventLoop(); + if ( eventLoop.inEventLoop() ) { - callback.done( result, error ); + if ( !ch.isClosing() ) + { + callback.done( result, error ); + } + return; } - } : (result, error) -> eventLoop.execute( () -> - { - if ( !ch.isClosing() ) + + eventLoop.execute( () -> { - callback.done( result, error ); - } - } ); + if ( !ch.isClosing() ) + { + callback.done( result, error ); + } + } ); + }; } }