From cd94217abde73aa8adfcc08440ef4664bcc0c5e7 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 19 May 2016 21:09:11 -0700 Subject: [PATCH] pool: minor. --- lib/bcoin/pool.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 2f67c6ab..1d065652 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -2036,11 +2036,15 @@ function LoadRequest(pool, peer, type, hash, callback) { assert(!this.pool.request.map[this.hash]); this.pool.request.map[this.hash] = this; - this._finish = this._ontimeout.bind(this); + this._finish = this.destroy.bind(this); } -LoadRequest.prototype._ontimeout = function _ontimeout() { - this.finish(new Error('Timeout.')); +/** + * Destroy load request with an error. + */ + +LoadRequest.prototype.destroy = function destroy() { + this.finish(new Error('Timeout or closed.')); }; /**