From 405f50e95da3f9866d3852c863a9800ee4688b23 Mon Sep 17 00:00:00 2001 From: Daniel McNally Date: Thu, 3 Dec 2020 12:17:56 -0500 Subject: [PATCH] fix(p2p): fix stall timer checks (#2015) This fixes a regression introduced in #1994 that prevents enabling the stall timer for peers that checks whether peers are not responding to our packets in a reasonable timeframe and disconnecting those that are not. Without these checks, peers that have gone offline may remain in the list of connected peers, resulting in unexpected behavior and also preventing those peers from establishing new connections with us once they come back online. Closes #2010. --- lib/p2p/Peer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/p2p/Peer.ts b/lib/p2p/Peer.ts index 21c9d5c6a..3f0717b72 100644 --- a/lib/p2p/Peer.ts +++ b/lib/p2p/Peer.ts @@ -617,7 +617,7 @@ class Peer extends EventEmitter { } private initStall = (): void => { - if (this.status !== PeerStatus.Closed) { + if (this.status === PeerStatus.Closed) { return; } assert(!this.stallTimer);