mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-25 01:09:28 +00:00
The testPeer request counters (nAccountRequests, nStorageRequests, nBytecodeRequests, nTrienodeRequests) were plain int fields incremented with ++. These increments happen in Request* methods that are invoked concurrently by the Syncer from multiple goroutines (assignBytecodeTasks, assignStorageTasks, etc.), causing a data race reliably detected by go test -race. Change the counters to atomic.Int64 so increments and reads are synchronized without introducing a mutex. Fixes races detected in TestMultiSyncManyUseless, TestMultiSyncManyUselessWithLowTimeout, TestMultiSyncManyUnresponsive, TestSyncWithStorageAndOneCappedPeer, TestSyncWithStorageAndCorruptPeer, and TestSyncWithStorageAndNonProvingPeer. |
||
|---|---|---|
| .. | ||
| discovery.go | ||
| gentrie.go | ||
| gentrie_test.go | ||
| handler.go | ||
| handler_fuzzing_test.go | ||
| handler_test.go | ||
| handlers.go | ||
| metrics.go | ||
| peer.go | ||
| progress_test.go | ||
| protocol.go | ||
| range.go | ||
| range_test.go | ||
| sort_test.go | ||
| sync.go | ||
| sync_test.go | ||