diff --git a/lib/net/pool.js b/lib/net/pool.js index e6bcb178..d918d5a1 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -354,6 +354,8 @@ Pool.prototype._disconnect = co(function* disconnect() { this.peers.destroy(); + this.nonces = new NonceList(); + this.requestMap.reset(); if (this.pendingFilter != null) { @@ -3727,8 +3729,15 @@ PeerList.prototype.destroy = function destroy() { for (peer = this.list.head; peer; peer = next) { next = peer.next; + + // stop processing peer events + peer.onPacket = null; + peer.removeAllListeners() + peer.destroy(); } + + this.list = new List(); }; /**