remove off-event-loop logic from inbound packet listeners (#1836)

This commit is contained in:
Pasqual Koschmieder 2022-08-12 23:29:07 +02:00 committed by GitHub
parent 1beb95115f
commit abc0db8281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -501,17 +501,6 @@ public class NettyChannelInjector implements Injector {
return; return;
} }
if (ctx.channel().eventLoop().inEventLoop()) {
// we're in a netty event loop - prevent that from happening as it slows down netty
// in normal cases netty only has 4 processing threads available which is *really* bad when we're
// then blocking these (or more specifically a plugin) to process the incoming packet
// See https://twitter.com/fbrasisil/status/1163974576511995904 for a reference what can happen
this.server.getScheduler().runTaskAsynchronously(
this.injectionFactory.getPlugin(),
() -> this.processInboundPacket(ctx, packet, packetClass));
return;
}
// call packet handlers, a null result indicates that we shouldn't change anything // call packet handlers, a null result indicates that we shouldn't change anything
PacketEvent interceptionResult = this.channelListener.onPacketReceiving(this, packet, null); PacketEvent interceptionResult = this.channelListener.onPacketReceiving(this, packet, null);
if (interceptionResult == null) { if (interceptionResult == null) {