Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server::new doesn't need to be async #23

Open
HexyWitch opened this issue Jan 7, 2023 · 1 comment
Open

Server::new doesn't need to be async #23

HexyWitch opened this issue Jan 7, 2023 · 1 comment

Comments

@HexyWitch
Copy link
Contributor

There are no awaits. Is it a future proofing thing?

No big deal but I made an issue just in case. Changing it would be a breaking API change so probably not worth a major version bump on its own.

@kyren
Copy link
Owner

kyren commented Jan 8, 2023

Oh it's not supposed to be there, it's a leftover from using tokio directly, and specifically using this method to create a UdpSocket : https://docs.rs/tokio/latest/tokio/net/struct.UdpSocket.html#method.bind

That method is async, but only because it accepts hostnames and does an optional DNS lookup on them. You can get around it by opening a std UdpSocket and then converting it to a tokio one, which is what is done in the tokio implementation of the Runtime trait now. I didn't realize why that method was async until I actually looked at it during the last refactor to being runtime agnostic with the Runtime trait.

It's just a leftover, and there hasn't even been a release since it could be removed so it should just be removed. Thank you for catching it 😔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants