mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 00:39:26 +00:00
eth/downloader: fix race condition in tests (#22140)
* downloader: fix race condition in tests
* eth/downloader: fix race condition in tests
* Revert "downloader: fix race condition in tests"
This reverts commit 108033ebc6.
This commit is contained in:
parent
889f5645b5
commit
89030ec0b4
1 changed files with 4 additions and 3 deletions
|
|
@ -584,14 +584,15 @@ func testThrottling(t *testing.T, protocol uint, mode SyncMode) {
|
||||||
time.Sleep(25 * time.Millisecond)
|
time.Sleep(25 * time.Millisecond)
|
||||||
|
|
||||||
tester.lock.Lock()
|
tester.lock.Lock()
|
||||||
|
tester.downloader.queue.lock.Lock()
|
||||||
|
tester.downloader.queue.resultCache.lock.Lock()
|
||||||
{
|
{
|
||||||
tester.downloader.queue.resultCache.lock.Lock()
|
|
||||||
cached = tester.downloader.queue.resultCache.countCompleted()
|
cached = tester.downloader.queue.resultCache.countCompleted()
|
||||||
tester.downloader.queue.resultCache.lock.Unlock()
|
|
||||||
frozen = int(atomic.LoadUint32(&blocked))
|
frozen = int(atomic.LoadUint32(&blocked))
|
||||||
retrieved = len(tester.ownBlocks)
|
retrieved = len(tester.ownBlocks)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
tester.downloader.queue.resultCache.lock.Unlock()
|
||||||
|
tester.downloader.queue.lock.Unlock()
|
||||||
tester.lock.Unlock()
|
tester.lock.Unlock()
|
||||||
|
|
||||||
if cached == blockCacheMaxItems ||
|
if cached == blockCacheMaxItems ||
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue