core/bloombis: fix possible data race caused by inconsistent field protection

This commit is contained in:
BurtonQin 2020-02-12 11:44:36 +08:00
parent 34bb132b10
commit cf8078e9d3

View file

@ -150,6 +150,7 @@ func (s *scheduler) scheduleDeliveries(pend chan uint64, done chan []byte, quit
// Wait until the request is honoured // Wait until the request is honoured
s.lock.Lock() s.lock.Lock()
res := s.responses[idx] res := s.responses[idx]
cached := res.cached
s.lock.Unlock() s.lock.Unlock()
select { select {
@ -161,7 +162,7 @@ func (s *scheduler) scheduleDeliveries(pend chan uint64, done chan []byte, quit
select { select {
case <-quit: case <-quit:
return return
case done <- res.cached: case done <- cached:
} }
} }
} }