Merge pull request #3185 from karalabe/fix-log-race
eth/downloader: fix a data race in a log output
This commit is contained in:
commit
437c1e40b2
@ -948,11 +948,12 @@ func (d *Downloader) fetchNodeData() error {
|
|||||||
}
|
}
|
||||||
d.syncStatsLock.Lock()
|
d.syncStatsLock.Lock()
|
||||||
d.syncStatsStateDone += uint64(delivered)
|
d.syncStatsStateDone += uint64(delivered)
|
||||||
|
syncStatsStateDone := d.syncStatsStateDone // Thread safe copy for the log below
|
||||||
d.syncStatsLock.Unlock()
|
d.syncStatsLock.Unlock()
|
||||||
|
|
||||||
// Log a message to the user and return
|
// Log a message to the user and return
|
||||||
if delivered > 0 {
|
if delivered > 0 {
|
||||||
glog.V(logger.Info).Infof("imported %3d state entries in %9v: processed %d, pending at least %d", delivered, common.PrettyDuration(time.Since(start)), d.syncStatsStateDone, pending)
|
glog.V(logger.Info).Infof("imported %3d state entries in %9v: processed %d, pending at least %d", delivered, common.PrettyDuration(time.Since(start)), syncStatsStateDone, pending)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user