#3781: Fix eventLoopCallback

This commit is contained in:
Valentine 2025-02-08 23:17:16 +02:00 committed by GitHub
parent dd2033bf1a
commit ed4a80eb0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 <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 );
}
} );
};
}
}