From 394df484085d288aa9426631fdeca00d354e623f Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 27 Jan 2017 00:11:34 -0800 Subject: [PATCH] pool: some cleanup. --- lib/net/pool.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/net/pool.js b/lib/net/pool.js index 77d0885d..6101617e 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -101,6 +101,7 @@ function Pool(options) { this.locker = new Lock(true); this.connected = false; + this.disconnecting = false; this.syncing = false; this.spvFilter = null; this.txFilter = null; @@ -344,6 +345,8 @@ Pool.prototype._disconnect = co(function* disconnect() { if (!this.connected) return; + this.disconnecting = true; + hashes = this.invMap.keys(); for (i = 0; i < hashes.length; i++) { @@ -352,9 +355,6 @@ Pool.prototype._disconnect = co(function* disconnect() { item.resolve(); } - // prevent peer list from trying to refill - this.disconnecting = true; - this.peers.destroy(); this.requestMap.reset(); @@ -1156,7 +1156,7 @@ Pool.prototype.handleClose = co(function* handleClose(peer, connected) { if (!outbound) return; - if(this.disconnecting) + if (this.disconnecting) return; this.refill();