mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
subfetcher.loop: return earlier when the subfetcher is cancelled
This commit is contained in:
parent
194d403e8e
commit
9d172df8bb
1 changed files with 3 additions and 4 deletions
|
|
@ -291,6 +291,9 @@ func (sf *subfetcher) loop() {
|
||||||
tasks := sf.tasks
|
tasks := sf.tasks
|
||||||
sf.tasks = nil
|
sf.tasks = nil
|
||||||
sf.lock.Unlock()
|
sf.lock.Unlock()
|
||||||
|
if !keepRunning {
|
||||||
|
return
|
||||||
|
}
|
||||||
// Prefetch all tasks
|
// Prefetch all tasks
|
||||||
for _, task := range tasks {
|
for _, task := range tasks {
|
||||||
if _, ok := sf.seen[string(task)]; ok {
|
if _, ok := sf.seen[string(task)]; ok {
|
||||||
|
|
@ -304,9 +307,5 @@ func (sf *subfetcher) loop() {
|
||||||
}
|
}
|
||||||
sf.seen[string(task)] = struct{}{}
|
sf.seen[string(task)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !keepRunning {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue