Merge pull request #1682 from infastin/fix/sender-deadlock

fix(core): potential sender goroutine deadlock
This commit is contained in:
Alex X
2025-04-08 11:26:18 +03:00
committed by GitHub

View File

@@ -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() {