Skip to content

Unhandled error: buf length isn't multiple of compact IP/PORTs (6 bytes) #38

@Theadd

Description

@Theadd

Greetings!

After updating to v2.6.0 from v2.0.0 I came across with [Error: buf length isn't multiple of compact IP/PORTs (6 bytes)] several times and I don't recall that error before. Although I wasn't really paying too much attention.

Error: buf length isn't multiple of compact IP/PORTs (6 bytes)
    at Function.compact2string.multi (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/compact2string/index.js:12:11)
    at Tracker._handleResponse (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/client.js:481:22)
    at /home/on-black-sails/cluster1/node_modules/bittorrent-tracker/client.js:277:37
    at ConcatStream.<anonymous> (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/concat-stream/index.js:32:43)
    at ConcatStream.emit (events.js:117:20)
    at finishMaybe (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:460:14)
    at afterWrite (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:340:3)
    at /home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:327:9
    at process._tickDomainCallback (node.js:463:13)

Should be handled here
Thrown by compact2string.multi:

compact2string.multi = function  (buf) {

  if(buf.length % 6 !== 0)
    throw new Error("buf length isn't multiple of compact IP/PORTs (6 bytes)");

  var output = [];
  for (var i = 0; i <= buf.length - 1; i = i + 6) {
    output.push(compact2string(buf.slice(i, i + 6)));
  }

  return output;
};

Thank you & Great job! =)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions