This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
LES: Better timeouts + Track failed requests #4093
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #3984, #4037
The timeout mechanism introduced is managed by the
RequestSet
struct: since the flow mechanism and request IDs allow us to make multiple requests of a peer, we need to have a sensible timeout scheme which doesn't overload the peer with requests and then drop them when they fail to respond.The
RequestSet
allows the peer to respond in the worst case as slowly as if requests were only dispatched one-by-one, while allowing the peer to respond to requests in a relatively arbitrary order (but assuming that earlier-dispatched requests will tend to be responded to first -- this enforces that no request is left unanswered indefinitely to mitigate some kinds of DoS attacks).Malformatted/bad responses now correctly have their
ReqId
passed to handlers as part of a disconnected peer'sunfulfilled
set. This is accomplished by having anid_guard
which must be defused in order to access the inner ReqId upon correct decoding. If not defused, the request id will be added to the peer'sfailed_requests
set.