[GH-ISSUE #310] Making the ServerFuture an actual future #141

Closed
opened 2026-03-07 22:25:55 +03:00 by kerem · 5 comments
Owner

Originally created by @vorner on GitHub (Dec 2, 2017).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/310

Currently, the ServerFuture creates its own Core. This is a common anti-pattern in many crates that they insist on creating their own core, which means if I want to have multiple ServerFuture's, or a ServerFuture and hypers HTTP server in one process, each needs to have its own thread.

The better way would be for the ServerFuture to actually be a future (maybe something like Future<Item = (), Error = io::Error>. That way I could create the server, compose it within some larger future (shutdown & error handling, for example) and spawn it onto my own core.

Originally created by @vorner on GitHub (Dec 2, 2017). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/310 Currently, the ServerFuture creates its own `Core`. This is a common anti-pattern in many crates that they insist on creating their own core, which means if I want to have multiple ServerFuture's, or a ServerFuture and hypers HTTP server in one process, each needs to have its own thread. The better way would be for the ServerFuture to actually *be* a future (maybe something like `Future<Item = (), Error = io::Error>`. That way I could create the server, compose it within some larger future (shutdown & error handling, for example) and spawn it onto my own core.
kerem 2026-03-07 22:25:55 +03:00
Author
Owner

@bluejekyll commented on GitHub (Dec 4, 2017):

As an aside, the reason for this is baked into the history of the project. It was never clear to me that people might want to have the DNS Server be a library, but of course that was short sighted... It should be fairly easy to refactor the ServerFuture to move the Core out and possibly the core.run into the named binary itself to drive it.

<!-- gh-comment-id:349057457 --> @bluejekyll commented on GitHub (Dec 4, 2017): As an aside, the reason for this is baked into the history of the project. It was never clear to me that people might want to have the DNS Server be a library, but of course that was short sighted... It should be fairly easy to refactor the ServerFuture to move the `Core` out and possibly the `core.run` into the named binary itself to drive it.
Author
Owner

@DemiMarie commented on GitHub (Mar 19, 2018):

@bluejekyll I can think of several reasons; for instance, one might want to have a single process containing a DNS server, an SMB server, an LDAP server, and a Kerberos KDC, so that a single process can act as a complete Windows domain controller.

<!-- gh-comment-id:374350804 --> @DemiMarie commented on GitHub (Mar 19, 2018): @bluejekyll I can think of several reasons; for instance, one might want to have a single process containing a DNS server, an SMB server, an LDAP server, and a Kerberos KDC, so that a single process can act as a complete Windows domain controller.
Author
Owner

@bluejekyll commented on GitHub (Mar 19, 2018):

I can definitely see the value in doing this. I’ve planned on doing this work, but just haven’t gotten the time. I agree that it should be done.

<!-- gh-comment-id:374351694 --> @bluejekyll commented on GitHub (Mar 19, 2018): I can definitely see the value in doing this. I’ve planned on doing this work, but just haven’t gotten the time. I agree that it should be done.
Author
Owner

@bluejekyll commented on GitHub (Mar 19, 2018):

And that’s a really neat idea.

<!-- gh-comment-id:374352076 --> @bluejekyll commented on GitHub (Mar 19, 2018): And that’s a really neat idea.
Author
Owner

@bluejekyll commented on GitHub (Apr 9, 2019):

I'm going to close this, as I think the ServerFuture and other supporting types like Catalog and Authority are in good shape for any Async work needed. We can reopen, or open another issue if changes are desired.

<!-- gh-comment-id:481445686 --> @bluejekyll commented on GitHub (Apr 9, 2019): I'm going to close this, as I think the ServerFuture and other supporting types like Catalog and Authority are in good shape for any Async work needed. We can reopen, or open another issue if changes are desired.
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#141
No description provided.