Guard main thread packet handling

This commit is contained in:
IzzelAliz 2022-07-18 21:30:06 +08:00
parent 1f5b6aea97
commit d444e01b37
No known key found for this signature in database
GPG Key ID: EE50E123A11D8338

View File

@ -33,7 +33,14 @@ public class PacketThreadUtilMixin {
return;
}
if (processor.getConnection().isConnected()) {
packetIn.handle(processor);
try {
packetIn.handle(processor);
} catch (Exception exception) {
if (processor.shouldPropagateHandlingExceptions()) {
throw exception;
}
LOGGER.error("Failed to handle packet {}, suppressing error", packetIn, exception);
}
} else {
LOGGER.debug("Ignoring packet due to disconnection: " + packetIn);
}