peer: fix race condition - open emitted after peer.close().
This commit is contained in:
parent
cc58b507eb
commit
889f796748
@ -290,6 +290,12 @@ Peer.prototype.open = co(function* open() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The peer may have been killed before
|
||||||
|
// the handshake finished. In this case,
|
||||||
|
// do not emit `open`.
|
||||||
|
if (this.destroyed)
|
||||||
|
return;
|
||||||
|
|
||||||
// Finally we can let the pool know
|
// Finally we can let the pool know
|
||||||
// that this peer is ready to go.
|
// that this peer is ready to go.
|
||||||
this.emit('open');
|
this.emit('open');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user