[GH-ISSUE #423] It should be possible to use a single DNS configuration/options object for multiple lookups #483

Closed
opened 2026-03-15 22:44:51 +03:00 by kerem · 3 comments
Owner

Originally created by @briansmith on GitHub (Apr 24, 2018).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/423

My application reads the configuration files (/etc/resolv.conf, /etc/hosts, etc.) using trust_dns_resolver::system_conf::read_system_conf() once at startup. I'd like to reuse the config/opts objects it returns for multiple asynchronous lookups. However, ResolverFuture::new() uses move semantics for its config and options arguments. I think it would be better to have ResolverFuture::new() take Rc<>s instead.

Originally created by @briansmith on GitHub (Apr 24, 2018). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/423 My application reads the configuration files (/etc/resolv.conf, /etc/hosts, etc.) using `trust_dns_resolver::system_conf::read_system_conf()` once at startup. I'd like to reuse the config/opts objects it returns for multiple asynchronous lookups. However, `ResolverFuture::new()` uses move semantics for its `config` and `options` arguments. I think it would be better to have `ResolverFuture::new()` take `Rc<>s` instead.
kerem closed this issue 2026-03-15 22:44:56 +03:00
Author
Owner

@bluejekyll commented on GitHub (Apr 24, 2018):

I'm guessing this means that in your use case the resolver is not long lived. I think this is fine. Right now ResolverOpts is fairly cheap, so that's copy. Right now, there are some restrictions on ResolverFuture, which I think will require Arc. Any issue with that?

<!-- gh-comment-id:383807982 --> @bluejekyll commented on GitHub (Apr 24, 2018): I'm guessing this means that in your use case the resolver is not long lived. I think this is fine. Right now ResolverOpts is fairly cheap, so that's copy. Right now, there are some restrictions on ResolverFuture, which I think will require `Arc`. Any issue with that?
Author
Owner

@bluejekyll commented on GitHub (Apr 25, 2018):

Out of curiosity, why not keep the ResolverFuture itself around instead just the Config? Is there a concern with that?

<!-- gh-comment-id:384138582 --> @bluejekyll commented on GitHub (Apr 25, 2018): Out of curiosity, why not keep the ResolverFuture itself around instead just the Config? Is there a concern with that?
Author
Owner

@briansmith commented on GitHub (Apr 26, 2018):

I agree that I should just reuse the ResolverFuture, but it is unclear if I can correctly do so in my project until #430 is resolved. I'm going to close this and I think PR #424 should be closed too,

<!-- gh-comment-id:384478575 --> @briansmith commented on GitHub (Apr 26, 2018): I agree that I should just reuse the `ResolverFuture`, but it is unclear if I can correctly do so in my project until #430 is resolved. I'm going to close this and I think PR #424 should be closed too,
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#483
No description provided.