Skip to content

Commit

Permalink
Recognize legacy ping in splitter. PrismarineJSGH-332
Browse files Browse the repository at this point in the history
  • Loading branch information
deathcap committed Jan 30, 2016
1 parent a6a673a commit c24718f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/transforms/framing.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ class Splitter extends Transform {
}
_transform(chunk, enc, cb) {
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 { value, size, error } = readVarInt(this.buffer, offset) || { error: "Not enough data" };
Expand Down

0 comments on commit c24718f

Please sign in to comment.