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:
Sergey Krashevich
2026-03-23 16:05:58 +03:00
committed by GitHub
parent 4a65f06864
commit 046096826b
5 changed files with 30 additions and 0 deletions
+6
View File
@@ -20,6 +20,12 @@ func crealityClient(url string) (core.Producer, error) {
return nil, err
}
defer func() {
if err != nil {
_ = pc.Close()
}
}()
prod := webrtc.NewConn(pc)
prod.FormatName = "webrtc/creality"
prod.Mode = core.ModeActiveProducer