pool: increase max header chain failures.

This commit is contained in:
Christopher Jeffrey 2017-02-23 08:37:58 -08:00
parent f6cb0f1a19
commit fb997d43bb
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -119,6 +119,15 @@ function Pool(options) {
util.inherits(Pool, AsyncObject); util.inherits(Pool, AsyncObject);
/**
* Max number of header chain failures
* before disabling checkpoints.
* @const {Number}
* @default
*/
Pool.MAX_HEADER_FAILS = 500;
/** /**
* Initialize the pool. * Initialize the pool.
* @private * @private
@ -1827,7 +1836,7 @@ Pool.prototype._handleHeaders = co(function* handleHeaders(peer, packet) {
'Peer sent a bad header chain (%s).', 'Peer sent a bad header chain (%s).',
peer.hostname()); peer.hostname());
if (++this.headerFails < 4) { if (++this.headerFails < Pool.MAX_HEADER_FAILS) {
peer.destroy(); peer.destroy();
return; return;
} }
@ -1848,7 +1857,7 @@ Pool.prototype._handleHeaders = co(function* handleHeaders(peer, packet) {
'Peer sent an invalid checkpoint (%s).', 'Peer sent an invalid checkpoint (%s).',
peer.hostname()); peer.hostname());
if (++this.headerFails < 4) { if (++this.headerFails < Pool.MAX_HEADER_FAILS) {
peer.destroy(); peer.destroy();
return; return;
} }