aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelföldi Zsolt <zsfelfoldi@gmail.com>2018-09-21 15:59:21 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-09-21 15:59:21 +0800
commitab13cd992405f84dc48b7d49b54c5de06a7cd5ab (patch)
treea5afd7f0e09b2e639764d11745c84cf05d638c31
parent32c05e82a379a00f42bfae5ea490867575f80a6d (diff)
downloadgo-tangerine-ab13cd992405f84dc48b7d49b54c5de06a7cd5ab.tar.gz
go-tangerine-ab13cd992405f84dc48b7d49b54c5de06a7cd5ab.tar.zst
go-tangerine-ab13cd992405f84dc48b7d49b54c5de06a7cd5ab.zip
les: fix invalid delivery handling in retriever (#17727)
-rw-r--r--les/retrieve.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/les/retrieve.go b/les/retrieve.go
index c3d788813..d77cfea74 100644
--- a/les/retrieve.go
+++ b/les/retrieve.go
@@ -212,11 +212,18 @@ func (r *sentReq) stateRequesting() reqStateFn {
// no need to go to stopped state because waiting() already returned false
return nil
}
- case rpSoftTimeout, rpDeliveredInvalid:
+ case rpSoftTimeout:
// last request timed out, try asking a new peer
go r.tryRequest()
r.lastReqQueued = true
return r.stateRequesting
+ case rpDeliveredInvalid:
+ // if it was the last sent request (set to nil by update) then start a new one
+ if !r.lastReqQueued && r.lastReqSentTo == nil {
+ go r.tryRequest()
+ r.lastReqQueued = true
+ }
+ return r.stateRequesting
case rpDeliveredValid:
r.stop(nil)
return r.stateStopped