mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 06:03:33 -04:00
Recognize legacy ping in splitter. GH-332
This commit is contained in:
parent
a6a673a8c8
commit
c24718f64c
@ -30,6 +30,13 @@ class Splitter extends Transform {
|
|||||||
}
|
}
|
||||||
_transform(chunk, enc, cb) {
|
_transform(chunk, enc, cb) {
|
||||||
this.buffer = Buffer.concat([this.buffer, chunk]);
|
this.buffer = Buffer.concat([this.buffer, chunk]);
|
||||||
|
|
||||||
|
if (this.buffer[0] === 0xfe) {
|
||||||
|
// legacy_server_list_ping packet follows a different protocol format, no varint length
|
||||||
|
this.push(this.buffer);
|
||||||
|
return cb();
|
||||||
|
}
|
||||||
|
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
|
|
||||||
var { value, size, error } = readVarInt(this.buffer, offset) || { error: "Not enough data" };
|
var { value, size, error } = readVarInt(this.buffer, offset) || { error: "Not enough data" };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user