mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-16 05:02:19 +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
|
// Decompress to content buffer
|
||||||
content = workerContext.contentBuffer.clear();
|
content = workerContext.contentBuffer.clear();
|
||||||
decompressedSize = dataLength;
|
decompressedSize = dataLength;
|
||||||
try {
|
Inflater inflater = workerContext.inflater;
|
||||||
Inflater inflater = workerContext.inflater;
|
inflater.setInput(readBuffer.asByteBuffer(readBuffer.readerOffset(), payloadLength));
|
||||||
inflater.setInput(readBuffer.asByteBuffer(readBuffer.readerOffset(), payloadLength));
|
inflater.inflate(content.asByteBuffer(0, dataLength));
|
||||||
inflater.inflate(content.asByteBuffer(0, dataLength));
|
inflater.reset();
|
||||||
inflater.reset();
|
|
||||||
} catch (DataFormatException e) {
|
|
||||||
MinecraftServer.getExceptionManager().handleException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Process packet
|
// Process packet
|
||||||
@ -156,6 +152,10 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||||||
readBuffer.reset(beginMark);
|
readBuffer.reset(beginMark);
|
||||||
this.cacheBuffer = BinaryBuffer.copy(readBuffer);
|
this.cacheBuffer = BinaryBuffer.copy(readBuffer);
|
||||||
break;
|
break;
|
||||||
|
} catch (DataFormatException e) {
|
||||||
|
MinecraftServer.getExceptionManager().handleException(e);
|
||||||
|
disconnect();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,9 +53,12 @@ public final class Worker extends Thread {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO print exception? (should ignore disconnection)
|
// TODO print exception? (should ignore disconnection)
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
MinecraftServer.getExceptionManager().handleException(e);
|
||||||
|
connection.disconnect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
MinecraftServer.getExceptionManager().handleException(e);
|
MinecraftServer.getExceptionManager().handleException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user