net: reduce request timeout to 2 min.

This commit is contained in:
Christopher Jeffrey 2016-11-28 17:49:44 -08:00
parent fa8b4c6428
commit bc4a9b3f14
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 9 additions and 1 deletions

View File

@ -2025,6 +2025,10 @@ Peer.prototype._handleInv = function _handleInv(packet) {
if (txs.length > 0)
this.emit('txs', txs);
this.logger.debug(
'Received inv packet with %d items: blocks=%d txs=%d (%s).',
items.length, blocks.length, txs.length, this.hostname);
if (unknown !== -1) {
this.logger.warning(
'Peer sent an unknown inv type: %d (%s).',
@ -2041,6 +2045,10 @@ Peer.prototype._handleInv = function _handleInv(packet) {
Peer.prototype._handleHeaders = function _handleHeaders(packet) {
var headers = packet.items;
this.logger.debug(
'Received headers packet with %d items (%s).',
items.length, this.hostname);
if (headers.length > 2000) {
this.setMisbehavior(100);
return;

View File

@ -138,7 +138,7 @@ function Pool(options) {
// Requested objects.
this.requestMap = {};
this.requestTimeout = 20 * 60000;
this.requestTimeout = 2 * 60000;
this.activeRequest = 0;
this.activeBlocks = 0;
this.activeTX = 0;