Skip to content

Commit ce02b03

Browse files
authored
Merge pull request #1682 from infastin/fix/sender-deadlock
fix(core): potential sender goroutine deadlock
2 parents 3e1b010 + 487527f commit ce02b03

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/core/track.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ func (s *Sender) Start() {
139139
}
140140
s.done = make(chan struct{})
141141

142-
go func() {
143-
// for range on nil chan is OK
144-
for packet := range s.buf {
142+
// pass buf directly so that it's impossible for buf to be nil
143+
go func(buf chan *Packet) {
144+
for packet := range buf {
145145
s.Output(packet)
146146
}
147147
close(s.done)
148-
}()
148+
}(s.buf)
149149
}
150150

151151
func (s *Sender) Wait() {

0 commit comments

Comments
 (0)