mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
fix memory leak when reloading the configuration (#4855)
When a path has a MPEG-TS, RTP or WebRTC source and the path configuration is reloaded, a routine was left open because the reload channel was not handled. This fixes the issue.
This commit is contained in:
parent
6d4dfff959
commit
61382e496b
10 changed files with 158 additions and 93 deletions
|
|
@ -80,15 +80,19 @@ func (s *Source) Run(params defs.StaticSourceRunParams) error {
|
|||
readerErr <- s.runReader(&desc, nc)
|
||||
}()
|
||||
|
||||
select {
|
||||
case err = <-readerErr:
|
||||
nc.Close()
|
||||
return err
|
||||
for {
|
||||
select {
|
||||
case err = <-readerErr:
|
||||
nc.Close()
|
||||
return err
|
||||
|
||||
case <-params.Context.Done():
|
||||
nc.Close()
|
||||
<-readerErr
|
||||
return fmt.Errorf("terminated")
|
||||
case <-params.ReloadConf:
|
||||
|
||||
case <-params.Context.Done():
|
||||
nc.Close()
|
||||
<-readerErr
|
||||
return fmt.Errorf("terminated")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue