Skip to content

Commit

Permalink
don't serve the session if all local peers are cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Jun 10, 2024
1 parent 7949f38 commit 4bafcc7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mixing/mixclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ func (c *Client) pairSession(ctx context.Context, ps *pairedSessions, prs []*wir
d.epoch = epoch
d.start(epoch)
for {
var localPeerCount int
var localPeerCount, localUncancelledCount int

if rerun == nil {
sid := mixing.SortPRsForSession(prs, unixEpoch)
Expand Down Expand Up @@ -963,6 +963,9 @@ func (c *Client) pairSession(ctx context.Context, ps *pairedSessions, prs []*wir
p := ps.localPeers[pr.Identity]
if p != nil {
localPeerCount++
if p.ctx.Err() == nil {
localUncancelledCount++
}
} else {
p = newRemotePeer(pr)
}
Expand All @@ -979,8 +982,8 @@ func (c *Client) pairSession(ctx context.Context, ps *pairedSessions, prs []*wir
sesLog.logf("created session for pairid=%x from %d total %d local PRs %s",
ps.pairing, len(prHashes), localPeerCount, prHashes)

if localPeerCount == 0 {
sesLog.logf("no more local peers")
if localUncancelledCount == 0 {
sesLog.logf("no more active local peers")
return
}

Expand Down

0 comments on commit 4bafcc7

Please sign in to comment.