-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add support for getaddrinfo #278
Conversation
@talex5 do you know if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks reasonable to me.
I think we should call this getaddrinfo
rather than addrinfo
though, as that's the name everyone uses for it (including OCaml's Unix module). Also, it may access the network so the getting part is quite important.
do you know if the ocaml-ci has ipv6 enabled? or how to enable it? The test for this PR seems to be failing as I expect Ipv6 address but the machine is not returning any.
What gets returned for localhost
will depend on the system configuration, so it's probably best to test it using numeric addresses.
@talex5 I have renamed |
One thing possibly worth mentioning is that users may wish to override this method to point to a non-libc implementation (especially on Alpine, where musl's Supporting this use case isn't a problem (capabilities make this very easy to do), but I do feel a bit weird about calling this function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either getaddrinfo
or resolve_addr
is fine with me. I don't think there's any problem with getaddrinfo
calling an alternative implementation as long as it does roughly the same thing. Otherwise we'd have to rename everything else too (e.g. unlink
and mkdir
might not be calling the glibc function either, if it's a remote directory, or a directory inside a zip archive).
e510251
to
caf4ee9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I added one test for port numbers and squash-rebased it on main
.
CHANGES: New features: - Add `Eio.Condition` (@TheLortex @talex5 ocaml-multicore/eio#277). Allows a fiber to wait for some condition to become true. - Add `Eio.Net.getaddrinfo` and `getnameinfo` (@bikallem @talex5 ocaml-multicore/eio#278 ocaml-multicore/eio#288 ocaml-multicore/eio#291). Convert between host names and addresses. - Add `Eio.Debug` (@talex5 ocaml-multicore/eio#276). Currently, this allows overriding the `traceln` function. - `Buf_write.create`: make switch optional (@talex5 ocaml-multicore/eio#283). This makes things easier for people porting code from Faraday. Bug fixes: - Allow sharing of libuv poll handles (@patricoferris @talex5 ocaml-multicore/eio#279). Luv doesn't allow two callers to watch the same file handle, so we need to handle that in Eio. Other changes: - Upgrade to uring 0.4 (@talex5 ocaml-multicore/eio#290). - Mention `Mutex`, `Semaphore` and `Condition` in the README (@talex5 ocaml-multicore/eio#281).
Fixes part of #258