Skip to content

Commit

Permalink
refactor(p2p): delete inactive pending peer
Browse files Browse the repository at this point in the history
  • Loading branch information
sangaman committed Oct 17, 2019
1 parent 6c6c6bd commit 24b4eb1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/p2p/Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,17 +869,17 @@ class Pool extends EventEmitter {
this.pendingOutboundPeers.delete(peer.expectedNodePubKey);
}

if (!peer.active) {
return;
}

if (peer.nodePubKey) {
this.pendingOutboundPeers.delete(peer.nodePubKey);
this.peers.delete(peer.nodePubKey);
}
this.emit('peer.close', peer.nodePubKey);
peer.removeAllListeners();

if (!peer.active) {
return;
}
peer.active = false;
this.emit('peer.close', peer.nodePubKey);

const shouldReconnect =
(peer.sentDisconnectionReason === undefined || peer.sentDisconnectionReason === DisconnectionReason.ResponseStalling) &&
Expand Down

0 comments on commit 24b4eb1

Please sign in to comment.