mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-14 03:56:36 +00:00
eth/downloader: fix a throughput estimation data race
This commit is contained in:
parent
edd7aa054c
commit
e3f2b541f2
1 changed files with 2 additions and 2 deletions
|
|
@ -251,8 +251,8 @@ func (p *peer) setIdle(started time.Time, delivered int, throughput *float64, id
|
||||||
// Irrelevant of the scaling, make sure the peer ends up idle
|
// Irrelevant of the scaling, make sure the peer ends up idle
|
||||||
defer atomic.StoreInt32(idle, 0)
|
defer atomic.StoreInt32(idle, 0)
|
||||||
|
|
||||||
p.lock.RLock()
|
p.lock.Lock()
|
||||||
defer p.lock.RUnlock()
|
defer p.lock.Unlock()
|
||||||
|
|
||||||
// If nothing was delivered (hard timeout / unavailable data), reduce throughput to minimum
|
// If nothing was delivered (hard timeout / unavailable data), reduce throughput to minimum
|
||||||
if delivered == 0 {
|
if delivered == 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue