Attempt to improve partial read situations during early connections
This commit is contained in:
@@ -98,7 +98,12 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
|
|||||||
state.getProtocolRegistry(direction, ProtocolVersion.MINIMUM_VERSION);
|
state.getProtocolRegistry(direction, ProtocolVersion.MINIMUM_VERSION);
|
||||||
|
|
||||||
final int index = in.readerIndex();
|
final int index = in.readerIndex();
|
||||||
final int packetId = ProtocolUtils.readVarInt(in);
|
final int packetId = readRawVarInt21(in);
|
||||||
|
// Index hasn't changed, we've read nothing
|
||||||
|
if (index == in.readerIndex()) {
|
||||||
|
in.resetReaderIndex();
|
||||||
|
return;
|
||||||
|
}
|
||||||
final int payloadLength = length - ProtocolUtils.varIntBytes(packetId);
|
final int payloadLength = length - ProtocolUtils.varIntBytes(packetId);
|
||||||
|
|
||||||
MinecraftPacket packet = registry.createPacket(packetId);
|
MinecraftPacket packet = registry.createPacket(packetId);
|
||||||
@@ -141,6 +146,7 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
|
|||||||
.withThrowable(cause)
|
.withThrowable(cause)
|
||||||
.log("Exception caught while decoding frame for {}", ctx.channel().remoteAddress());
|
.log("Exception caught while decoding frame for {}", ctx.channel().remoteAddress());
|
||||||
}
|
}
|
||||||
|
super.exceptionCaught(ctx, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user