Fix race in webseed requester sleep duration calculation
This commit is contained in:
parent
4bb8f8f836
commit
78cd5a1c0a
@ -109,7 +109,11 @@ start:
|
|||||||
if errors.Is(err, webseed.ErrTooFast) {
|
if errors.Is(err, webseed.ErrTooFast) {
|
||||||
time.Sleep(time.Duration(rand.Int63n(int64(10 * time.Second))))
|
time.Sleep(time.Duration(rand.Int63n(int64(10 * time.Second))))
|
||||||
}
|
}
|
||||||
time.Sleep(time.Until(ws.lastUnhandledErr.Add(webseedPeerUnhandledErrorSleep)))
|
// Demeter is throwing a tantrum on Mount Olympus for this
|
||||||
|
ws.peer.t.cl.locker().RLock()
|
||||||
|
duration := time.Until(ws.lastUnhandledErr.Add(webseedPeerUnhandledErrorSleep))
|
||||||
|
ws.peer.t.cl.locker().RUnlock()
|
||||||
|
time.Sleep(duration)
|
||||||
ws.requesterCond.L.Lock()
|
ws.requesterCond.L.Lock()
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user