Merge pull request #1152 from strukturag/fix-subscriber-close-on-error

Close subscriber synchronously on errors.
This commit is contained in:
Joachim Bauch 2025-12-11 08:58:15 +01:00 committed by GitHub
commit 8ed1f15b95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -236,7 +236,7 @@ retry:
switch error_code {
case JANUS_VIDEOROOM_ERROR_NO_SUCH_ROOM:
p.logger.Printf("Publisher %s not created yet for %s, not joining room %d as subscriber", p.publisher, p.streamType, p.roomId)
go p.Close(context.Background())
p.Close(context.Background())
callback(fmt.Errorf("Publisher %s not created yet for %s", p.publisher, p.streamType), nil)
return
case JANUS_VIDEOROOM_ERROR_NO_SUCH_FEED:
@ -249,7 +249,7 @@ retry:
}
if err := waiter.Wait(ctx); err != nil {
go p.Close(context.Background())
p.Close(context.Background())
callback(err, nil)
return
}