mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-07 01:03:07 +08:00
Merge pull request #1682 from infastin/fix/sender-deadlock
fix(core): potential sender goroutine deadlock
This commit is contained in:
@@ -139,13 +139,13 @@ func (s *Sender) Start() {
|
|||||||
}
|
}
|
||||||
s.done = make(chan struct{})
|
s.done = make(chan struct{})
|
||||||
|
|
||||||
go func() {
|
// pass buf directly so that it's impossible for buf to be nil
|
||||||
// for range on nil chan is OK
|
go func(buf chan *Packet) {
|
||||||
for packet := range s.buf {
|
for packet := range buf {
|
||||||
s.Output(packet)
|
s.Output(packet)
|
||||||
}
|
}
|
||||||
close(s.done)
|
close(s.done)
|
||||||
}()
|
}(s.buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sender) Wait() {
|
func (s *Sender) Wait() {
|
||||||
|
Reference in New Issue
Block a user