mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #524] Refactor all uses of tokio::executor::spawn into background tasks #218
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#218
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bluejekyll on GitHub (Jul 9, 2018).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/524
See Background in resolver.
client_future::ClientFuture::with_timeoutname_server_pool::ConnectionProvider::new_connection()@hawkw commented on GitHub (Jul 9, 2018):
I've started on this in a branch but it may take some time, as it looks like the change will affect a lot of code.
@bluejekyll commented on GitHub (Jul 9, 2018):
Oh, nice! Thanks for picking this up. We could split this into two different issues, one for name_server_pool and the other for client_future if you want. The name_server_pool one would help clean up some of the Resolver Background stuff you wrote before.
When I was doing some recent refactoring, I was trying to pull a lot of that up the stack...
@hawkw commented on GitHub (Jul 9, 2018):
Yeah, that was the plan. I think the
client_futurechange is not going to be terribly difficult, but it looks like a lot of other code that depends on it will need to be changed as well.Yeah, I'm hoping that will be able to be simplified at least a bit!
@hawkw commented on GitHub (Jul 10, 2018):
Another update: I started this morning on changing
name_server_pool::ConnectionProvider::new_connection()to return a background future, but have run in to a bit of an issue: thetry_reconnectfunction inNameServercurrently also callsConnectionProvider::new_connectionif reconnecting is necessary, and the background future returned will need to be spawned again any time theNameServerreconnects due to an error.To solve this, I'm going to try to move the reconnect logic into the background future itself, so that it need only be spawned once and that future will handle reconnecting as necessary. However, I think that's a slightly bigger refactor than I had initially expected, so this may take a little time.
@bluejekyll commented on GitHub (Jul 10, 2018):
Yeah, that makes sense. I also think it makes sense to keep the reconnect logic inside the background task. I think the only thing to consider is to make sure reconnect only is attempted after a poll (lazily) and not (eagerly) immediately after a failure, if that makes sense.
Making the background basically a set of states, Disconnected (start) -> Connected <-> Failed -> Disconnected, or something like that seems like it would make the most sense.
@hawkw commented on GitHub (Jul 10, 2018):
Yeah, that's more or less what I had in mind.
Currently, I'm doing some thinking about how to structure this so that it doesn't introduce an additional
mpscchannel between aNameServerand the connection, but I'm not sure whether or not that will be possible.@bluejekyll commented on GitHub (Jul 11, 2018):
I just cleaned up a few of those... and yes, it's hard in this context not to need that.