Skip to content

Commit

Permalink
SpigotMC#3781: Fix eventLoopCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
BoomEaro authored Feb 8, 2025
1 parent dd2033b commit ed4a80e
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -899,19 +899,25 @@ public CompletableFuture<byte[]> sendData(String channel, byte[] data)
// otherwise netty will schedule any pipeline related call by itself, this decreases performance
private <T> Callback<T> eventLoopCallback(Callback<T> 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 );
}
} );
};
}
}

0 comments on commit ed4a80e

Please sign in to comment.