Check for closed immediately before processing a packet

This commit is contained in:
Camotoy 2021-08-24 09:31:19 -04:00
parent a1d167d5f1
commit 77119316f5
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
2 changed files with 8 additions and 1 deletions

View file

@ -220,7 +220,10 @@ public class GeyserSession implements CommandSender {
@Setter
private boolean spawned;
private boolean closed;
/**
* Accessed on the initial Java and Bedrock packet processing threads
*/
private volatile boolean closed;
@Setter
private GameMode gameMode = GameMode.SURVIVAL;

View file

@ -107,6 +107,10 @@ public class PacketTranslatorRegistry<T> {
}
private <P extends T> void translate0(GeyserSession session, PacketTranslator<P> translator, P packet) {
if (session.isClosed()) {
return;
}
try {
translator.translate(packet, session);
} catch (Throwable ex) {