Skip to content

Commit

Permalink
Allow publishers to re-connect
Browse files Browse the repository at this point in the history
Resolves #134
  • Loading branch information
Sean-Der committed Jun 4, 2024
1 parent 4a3b4a1 commit c1a00a1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions internal/webrtc/webrtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,18 @@ func peerConnectionDisconnected(streamKey string, whepSessionId string) {
return
}

stream.whepSessionsLock.Lock()
defer stream.whepSessionsLock.Unlock()

if whepSessionId != "" {
stream.whepSessionsLock.Lock()
defer stream.whepSessionsLock.Unlock()
delete(stream.whepSessions, whepSessionId)
} else {
stream.hasWHIPClient.Store(false)
}

// Only delete stream if all WHEP Sessions are gone and have no WHIP Client
if len(stream.whepSessions) != 0 || stream.hasWHIPClient.Load() {
return
}
// Only delete stream if all WHEP Sessions are gone and have no WHIP Client
if len(stream.whepSessions) != 0 || stream.hasWHIPClient.Load() {
return
}

stream.whipActiveContextCancel()
Expand Down

0 comments on commit c1a00a1

Please sign in to comment.