Skip to content

Commit

Permalink
during stream setup also inc active to avoid the core closing underne…
Browse files Browse the repository at this point in the history
…ath us
  • Loading branch information
mafintosh committed Sep 16, 2024
1 parent d672aac commit a3b81f8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/replicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2295,8 +2295,11 @@ module.exports = class Replicator {
protomux.stream.setMaxListeners(0)
protomux.stream.on('close', this._onstreamclose)

if (useSession) this.core.active++
this._ifAvailable++

protomux.stream.opened.then((opened) => {
if (useSession) this.core.active--
this._ifAvailable--

if (opened && !this.destroyed) makePeer()
Expand Down

0 comments on commit a3b81f8

Please sign in to comment.