运行一会,会报 RangeError: index out of range 错误
xudongcc opened this issue · comments
node 版本v5.10
请提供下整个报错信息.
/root/p2pspider/lib/wire.js:0
RangeError: index out of range
at checkOffset (buffer.js:761:11)
at Buffer.readUInt32BE (buffer.js:835:5)
at Wire._onMessageLength (/root/p2pspider/lib/wire.js:43:25)
at Wire._write (/root/p2pspider/lib/wire.js:231:14)
at doWrite (_stream_writable.js:301:12)
at writeOrBuffer (_stream_writable.js:287:5)
at Writable.write (_stream_writable.js:215:11)
at Socket.ondata (_stream_readable.js:536:20)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
使用的代码:
'use strict';
var P2PSpider = require('./lib');
var p2p = P2PSpider({
nodesMaxSize: 200, // be careful
maxConnections: 400, // be careful
timeout: 5000
});
p2p.ignore(function (infohash, rinfo, callback) {
// false => always to download the metadata even though the metadata is exists.
var theInfohashIsExistsInDatabase = false;
callback(theInfohashIsExistsInDatabase);
});
p2p.on('metadata', function (metadata) {
// At here, you can extract data and save into database.
console.log(metadata);
});
p2p.listen(6881, '0.0.0.0');
RangeError: index out of range
at checkOffset (buffer.js:761:11)
at Buffer.readUInt8 (buffer.js:799:5)
at null.<anonymous> (/root/p2pspider/lib/wire.js:83:30)
at Wire._write (/root/p2pspider/lib/wire.js:233:14)
at doWrite (_stream_writable.js:301:12)
at writeOrBuffer (_stream_writable.js:287:5)
at Writable.write (_stream_writable.js:215:11)
at Socket.ondata (_stream_readable.js:536:20)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
还是有些问题。