Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove cancellation logic for HostResolver requests
Requests (ResolveHostRequest and ProbeRequest) are associated with a Context, to which they hold a non-owning pointer. This context must exist when the Request is created, but the Request can outlive its Context, and its state must change to avoid attempting to use the expired pointer. Additionally, some ResolveHostRequests are associated with a Job, and both hold non-owning pointers to the other. Either can outlive the other, so either must be notified when the other is destroyed, especially because they both have cleanup actions that are triggered. Currently, ContextHostResolvers maintain a non-owning list of all Requests for the context, in order to notify them when the context is destroyed. Requests then cancel their Jobs if necessary. HostResolverManager also maintains a (non-owning) list of active contexts and an (owning) map of Jobs, keyed by context. This change removes the need for explicit cancellation of Requests. Instead, context shutdown destroys all the relevant Jobs, which notify their affected Requests to perform cleanup actions. The remaining Requests only hold a WeakPtr to the context, and have no cleanup actions to take, so they do not need to be notified at all. This reduces complexity and enables the use of Jobs that do not have a Request. As a side effect, calls to Request::Start() after the context is destroyed now return ERR_CONTEXT_SHUT_DOWN instead of ERR_NAME_NOT_RESOLVED. Bug: 1200908 Change-Id: I43941aa981660b95a86842833fd9c94f56d1cdab Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3293904 Reviewed-by: Eric Orth <ericorth@chromium.org> Commit-Queue: Ben Schwartz <bemasc@chromium.org> Cr-Commit-Position: refs/heads/main@{#949222}
- Loading branch information
Benjamin M. Schwartz
authored and
Chromium LUCI CQ
committed
Dec 7, 2021
1 parent
3eb8c24
commit 4a56172
Showing
9 changed files
with
229 additions
and
598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.