From af6a87b10f8de39ce1fcfce9bfe400e211a54b70 Mon Sep 17 00:00:00 2001 From: Billie Hilton <587740+billiegoose@users.noreply.github.com> Date: Mon, 24 Jun 2024 16:26:04 -0400 Subject: [PATCH] reset attempts back to 0, not to 1 --- lib/peer-info.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/peer-info.js b/lib/peer-info.js index 8ac79e5..ed1b329 100644 --- a/lib/peer-info.js +++ b/lib/peer-info.js @@ -66,11 +66,12 @@ module.exports = class PeerInfo extends EventEmitter { } _disconnected () { - if (this.connectedTime > -1) { - if ((Date.now() - this.connectedTime) >= MIN_CONNECTION_TIME) this.attempts = 0 // fast retry - this.connectedTime = -1 + if (this.connectedTime > -1 && (Date.now() - this.connectedTime) >= MIN_CONNECTION_TIME) { + this.attempts = 0 // fast retry + } else { + this.attempts++ } - this.attempts++ + this.connectedTime = -1 } _deprioritize () {