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

Clarifications about lookup_addr() #26

Closed
GyulyVGC opened this issue Jan 4, 2023 · 1 comment
Closed

Clarifications about lookup_addr() #26

GyulyVGC opened this issue Jan 4, 2023 · 1 comment

Comments

@GyulyVGC
Copy link

GyulyVGC commented Jan 4, 2023

After having read the documentation I still have some doubts.

When does lookup_addr() exactly return an Err? Has this function some kind of timeout?

I would like to use this function in a real time application and I'm wondering if it'd be better to launch this function on a separate thread waiting for its result, since DNS lookups can take up to some hundreds of milliseconds.

@keeperofdakeys
Copy link
Owner

This library is essentially a Rust wrapper for getnameinfo and gethostinfo. These functions are usually defined in the libc for your platform (like gnulibc, microsoft's libc, a BSD libc, etc). So you need to check the documentation for your platform's libc to get the exact behaviour around timing. AFAIK there is no guarantee on how long these functions can take.

If you're looking up reverse dns for something like logging, it might be worth having another thread that can do that logging and the respective reverse dns lookups.

Feel free to ask more questions, but I'm going to close this issue since it's upto the libc library to determine the delay.

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