fix(webrtc): handle client connection errors gracefully (#2173)
- add deferred function to close the client connection on error - ensure proper cleanup for all client functions
This commit is contained in:
committed by
GitHub
parent
4a65f06864
commit
046096826b
@@ -192,6 +192,12 @@ func milestoneClient(rawURL string, query url.Values) (core.Producer, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
_ = pc.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
prod := webrtc.NewConn(pc)
|
||||
prod.FormatName = "webrtc/milestone"
|
||||
prod.Mode = core.ModeActiveProducer
|
||||
|
||||
Reference in New Issue
Block a user