fix close race in basicTracer

This commit is contained in:
vyzo 2020-04-21 21:02:12 +03:00
parent faf920414d
commit a613f097ed
1 changed files with 2 additions and 2 deletions

View File

@ -46,8 +46,9 @@ type basicTracer struct {
func (t *basicTracer) Trace(evt *pb.TraceEvent) {
t.mx.Lock()
defer t.mx.Unlock()
if t.closed {
t.mx.Unlock()
return
}
@ -56,7 +57,6 @@ func (t *basicTracer) Trace(evt *pb.TraceEvent) {
} else {
t.buf = append(t.buf, evt)
}
t.mx.Unlock()
select {
case t.ch <- struct{}{}: