mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Ensure that the read buffer can contain a single full packet
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
4f382c5684
commit
22b0c70500
@ -40,7 +40,7 @@ public final class Worker extends Thread {
|
|||||||
final SocketChannel channel = (SocketChannel) key.channel();
|
final SocketChannel channel = (SocketChannel) key.channel();
|
||||||
if (!channel.isOpen()) return;
|
if (!channel.isOpen()) return;
|
||||||
if (!key.isReadable()) return;
|
if (!key.isReadable()) return;
|
||||||
var connection = connectionMap.get(channel);
|
PlayerSocketConnection connection = connectionMap.get(channel);
|
||||||
try {
|
try {
|
||||||
var readBuffer = context.readBuffer;
|
var readBuffer = context.readBuffer;
|
||||||
// Consume last incomplete packet
|
// Consume last incomplete packet
|
||||||
@ -92,7 +92,7 @@ public final class Worker extends Thread {
|
|||||||
* Contains objects that we can be shared across all the connection of a {@link Worker worker}.
|
* Contains objects that we can be shared across all the connection of a {@link Worker worker}.
|
||||||
*/
|
*/
|
||||||
public static final class Context {
|
public static final class Context {
|
||||||
public final BinaryBuffer readBuffer = BinaryBuffer.ofSize(Server.SOCKET_BUFFER_SIZE);
|
public final BinaryBuffer readBuffer = BinaryBuffer.ofSize(Server.MAX_PACKET_SIZE);
|
||||||
public final BinaryBuffer contentBuffer = BinaryBuffer.ofSize(Server.MAX_PACKET_SIZE);
|
public final BinaryBuffer contentBuffer = BinaryBuffer.ofSize(Server.MAX_PACKET_SIZE);
|
||||||
public final Inflater inflater = new Inflater();
|
public final Inflater inflater = new Inflater();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user