Skip to content

Commit

Permalink
reset attempts back to 0, not to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
billiegoose committed Jun 24, 2024
1 parent 1e5ff05 commit af6a87b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/peer-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit af6a87b

Please sign in to comment.