Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-06 00:00:47 +01:00
Handle empty packets too
Dieser Commit ist enthalten in:
Ursprung
c856635ac5
Commit
f27aa8e3ba
@ -33,8 +33,10 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
|
|||||||
if (reader.result == DecodeResult.SUCCESS) {
|
if (reader.result == DecodeResult.SUCCESS) {
|
||||||
if (reader.readVarint < 0) {
|
if (reader.readVarint < 0) {
|
||||||
throw BAD_LENGTH_CACHED;
|
throw BAD_LENGTH_CACHED;
|
||||||
}
|
} else if (reader.readVarint == 0) {
|
||||||
|
// skip over the empty packet and ignore it
|
||||||
|
in.readerIndex(varintEnd + 1);
|
||||||
|
} else {
|
||||||
int minimumRead = reader.bytesRead + reader.readVarint;
|
int minimumRead = reader.bytesRead + reader.readVarint;
|
||||||
if (in.isReadable(minimumRead)) {
|
if (in.isReadable(minimumRead)) {
|
||||||
out.add(in.retainedSlice(varintEnd + 1, reader.readVarint));
|
out.add(in.retainedSlice(varintEnd + 1, reader.readVarint));
|
||||||
@ -42,6 +44,7 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (reader.result == DecodeResult.TOO_BIG) {
|
} else if (reader.result == DecodeResult.TOO_BIG) {
|
||||||
throw VARINT_BIG_CACHED;
|
throw VARINT_BIG_CACHED;
|
||||||
} else if (reader.result == DecodeResult.TOO_SHORT) {
|
} else if (reader.result == DecodeResult.TOO_SHORT) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren