Skip to content

Commit

Permalink
ensure all peers are removed
Browse files Browse the repository at this point in the history
  • Loading branch information
chm-diederichs committed Oct 1, 2024
1 parent b8cd2e0 commit 008a396
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/replicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2327,9 +2327,10 @@ module.exports = class Replicator {
clearTimeout(this._downloadingTimer)
this._downloadingTimer = null
}
for (const peer of this.peers) {
while (this.peers.length) {
const peer = this.peers[this.peers.length - 1]
this.detachFrom(peer.protomux)
peer.channel.close()
peer.channel.close() // peer is removed from array in onclose
}
for (const protomux of this._attached) {
this.detachFrom(protomux)
Expand Down

0 comments on commit 008a396

Please sign in to comment.