diff --git a/lib/net/peer.js b/lib/net/peer.js index 932576bc..5c88b349 100644 --- a/lib/net/peer.js +++ b/lib/net/peer.js @@ -290,6 +290,12 @@ Peer.prototype.open = co(function* open() { 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 // that this peer is ready to go. this.emit('open');