From bc4a9b3f14a2648dd325816c09b962da0d87f9b4 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 28 Nov 2016 17:49:44 -0800 Subject: [PATCH] net: reduce request timeout to 2 min. --- lib/net/peer.js | 8 ++++++++ lib/net/pool.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/net/peer.js b/lib/net/peer.js index cc209e1c..e8334c9c 100644 --- a/lib/net/peer.js +++ b/lib/net/peer.js @@ -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; diff --git a/lib/net/pool.js b/lib/net/pool.js index 811ff318..36f8f20a 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -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;