mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[GH-ISSUE #977] Can runtime arguments be made optional? #581
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#581
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 @dfoxfranke on GitHub (Dec 29, 2019).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/977
Having to pass a
tokio::runtime::Handlein order to construct anAsyncResolver(or aTokioConnectionProvider) is slightly awkward because it means that programs which useAsyncResolvercan't be written with a main function declared using#[tokio::main]. Programs which use#[tokio::main]never explicitly construct a tokio runtime and have no means of obtaining a handle to the one that tokio implicitly constructs. Could theruntimeargument be madeOptional, such that ifNoneis passed then the resolver will just spawn tasks on the default executor usingtokio::spawn()?@bluejekyll commented on GitHub (Dec 29, 2019):
I'd consider it. I hate relying on thread local storage for this stuff, it makes testing really difficult. Let me review our options in this area.
It might be that we could pass in a
TokioTlsHandlethat carries no data, and just callstokio::spawn. I think that would be fine. And that could be the default you're looking for.@bluejekyll commented on GitHub (Dec 30, 2019):
Ok, I think we're going to handle this in the tokio library itself: https://github.com/tokio-rs/tokio/pull/2040
Once that or something like it lands, we can then have a default method on trust-dns-resolver then takes the thread-local instantiated Handle, which will work in this case.
@bluejekyll commented on GitHub (Jan 8, 2020):
FYI, with https://docs.rs/tokio/0.2.8/tokio/runtime/struct.Handle.html#method.current now in Tokio, users should be able to get a handle to the current runtime in a
#[tokio::main]. I'll add a function for initializing trust-dns-resolver so that the extra code isn't necessary.@gzbakku commented on GitHub (Oct 25, 2020):
has this problem been resolved
how to do this??
@djc commented on GitHub (Oct 26, 2020):
I think this has been solved? At least you can in 0.19 instantiate a
TokioAsyncResolverthat doesn't require you to pass in aHandle.@dfoxfranke commented on GitHub (Oct 27, 2020):
Yes, this should be closed with the addition of the
tokio_from_system_conf()constructor.