This commit is contained in:
Andrew Steinborn
2021-08-21 02:23:29 -04:00
parent e6a93ad0c6
commit 5303239f66
2 changed files with 4 additions and 2 deletions

View File

@@ -51,7 +51,10 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
return;
}
if (reader.getResult() == DecodeResult.SUCCESS) {
if (reader.getResult() == DecodeResult.RUN_OF_ZEROES) {
// this will return to the point where the next varint starts
in.readerIndex(varintEnd);
} else if (reader.getResult() == DecodeResult.SUCCESS) {
int readVarint = reader.getReadVarint();
int bytesRead = reader.getBytesRead();
if (readVarint < 0) {

View File

@@ -33,7 +33,6 @@ class VarintByteDecoder implements ByteProcessor {
return true;
}
if (result == DecodeResult.RUN_OF_ZEROES) {
result = DecodeResult.SUCCESS;
return false;
}
readVarint |= (k & 0x7F) << bytesRead++ * 7;