mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-09-27 04:36:12 +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{})
|
||||
|
||||
go func() {
|
||||
// for range on nil chan is OK
|
||||
for packet := range s.buf {
|
||||
// pass buf directly so that it's impossible for buf to be nil
|
||||
go func(buf chan *Packet) {
|
||||
for packet := range buf {
|
||||
s.Output(packet)
|
||||
}
|
||||
close(s.done)
|
||||
}()
|
||||
}(s.buf)
|
||||
}
|
||||
|
||||
func (s *Sender) Wait() {
|
||||
|
Reference in New Issue
Block a user