mirror of
https://github.com/bluenviron/mediamtx.git
synced 2026-01-09 20:02:01 -08:00
fix freeze during server shutdown
This commit is contained in:
parent
35ea0233f3
commit
a9ff21278c
2 changed files with 10 additions and 3 deletions
|
|
@ -198,13 +198,22 @@ outer:
|
|||
}
|
||||
|
||||
go func() {
|
||||
for range cm.clientClose {
|
||||
for {
|
||||
select {
|
||||
case _, ok := <-cm.clientClose:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
case <-cm.pathMan.ClientClose():
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
for c := range cm.clients {
|
||||
c.Close()
|
||||
}
|
||||
|
||||
cm.wg.Wait()
|
||||
|
||||
close(cm.clientClose)
|
||||
|
|
|
|||
|
|
@ -287,7 +287,6 @@ outer:
|
|||
|
||||
delete(pa.clients, req.Client)
|
||||
pa.clientsWg.Done()
|
||||
|
||||
close(req.Res)
|
||||
|
||||
case <-pa.terminate:
|
||||
|
|
@ -419,7 +418,6 @@ func (pa *Path) exhaustChannels() {
|
|||
}
|
||||
|
||||
pa.clientsWg.Done()
|
||||
|
||||
close(req.Res)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue