pool: some cleanup.
This commit is contained in:
parent
a61679c4a9
commit
394df48408
@ -101,6 +101,7 @@ function Pool(options) {
|
|||||||
|
|
||||||
this.locker = new Lock(true);
|
this.locker = new Lock(true);
|
||||||
this.connected = false;
|
this.connected = false;
|
||||||
|
this.disconnecting = false;
|
||||||
this.syncing = false;
|
this.syncing = false;
|
||||||
this.spvFilter = null;
|
this.spvFilter = null;
|
||||||
this.txFilter = null;
|
this.txFilter = null;
|
||||||
@ -344,6 +345,8 @@ Pool.prototype._disconnect = co(function* disconnect() {
|
|||||||
if (!this.connected)
|
if (!this.connected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
this.disconnecting = true;
|
||||||
|
|
||||||
hashes = this.invMap.keys();
|
hashes = this.invMap.keys();
|
||||||
|
|
||||||
for (i = 0; i < hashes.length; i++) {
|
for (i = 0; i < hashes.length; i++) {
|
||||||
@ -352,9 +355,6 @@ Pool.prototype._disconnect = co(function* disconnect() {
|
|||||||
item.resolve();
|
item.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent peer list from trying to refill
|
|
||||||
this.disconnecting = true;
|
|
||||||
|
|
||||||
this.peers.destroy();
|
this.peers.destroy();
|
||||||
|
|
||||||
this.requestMap.reset();
|
this.requestMap.reset();
|
||||||
@ -1156,7 +1156,7 @@ Pool.prototype.handleClose = co(function* handleClose(peer, connected) {
|
|||||||
if (!outbound)
|
if (!outbound)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(this.disconnecting)
|
if (this.disconnecting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.refill();
|
this.refill();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user