mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-05 18:32:28 +01:00
Add more try-catch to prevent the worker from returning
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
d89e5cf2ee
commit
2f1e4101d1
@ -125,14 +125,10 @@ public class PlayerSocketConnection extends PlayerConnection {
|
||||
// Decompress to content buffer
|
||||
content = workerContext.contentBuffer.clear();
|
||||
decompressedSize = dataLength;
|
||||
try {
|
||||
Inflater inflater = workerContext.inflater;
|
||||
inflater.setInput(readBuffer.asByteBuffer(readBuffer.readerOffset(), payloadLength));
|
||||
inflater.inflate(content.asByteBuffer(0, dataLength));
|
||||
inflater.reset();
|
||||
} catch (DataFormatException e) {
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
}
|
||||
Inflater inflater = workerContext.inflater;
|
||||
inflater.setInput(readBuffer.asByteBuffer(readBuffer.readerOffset(), payloadLength));
|
||||
inflater.inflate(content.asByteBuffer(0, dataLength));
|
||||
inflater.reset();
|
||||
}
|
||||
}
|
||||
// Process packet
|
||||
@ -156,6 +152,10 @@ public class PlayerSocketConnection extends PlayerConnection {
|
||||
readBuffer.reset(beginMark);
|
||||
this.cacheBuffer = BinaryBuffer.copy(readBuffer);
|
||||
break;
|
||||
} catch (DataFormatException e) {
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
disconnect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,9 +53,12 @@ public final class Worker extends Thread {
|
||||
} catch (IOException e) {
|
||||
// TODO print exception? (should ignore disconnection)
|
||||
connection.disconnect();
|
||||
} catch (IllegalArgumentException e) {
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
connection.disconnect();
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user