-
Notifications
You must be signed in to change notification settings - Fork 427
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
improve connection to remote #737
base: master
Are you sure you want to change the base?
Conversation
src/hackney_happy.erl
Outdated
?report_debug("happy eyeballs, try to connect using IPv6", [{hostname, Hostname}, {port, Port}]), | ||
Self = self(), | ||
Addrs = getaddrs(Hostname), | ||
Pid = spawn_link( fun() -> try_connect(Addrs, Port, Opts, Self, {error, nxdomain}) end), |
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.
no need to spawn here, ,,either wya makes DNS resolution asynchronous.
I should provide a way to bypass DNS resolution and allows the user to force the way it wants to make a connection. Also allow them to choose the preference (for those that have to support the legacy with IPv4). |
getaddrs(Hostname) -> | ||
IP6Addrs = [{Addr, 'inet6'} || Addr <- getbyname(Hostname, 'aaaa')], | ||
IP4Addrs = [{Addr, 'inet'} || Addr <- getbyname(Hostname, 'a')], | ||
IP6Addrs ++ IP4Addrs. |
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.
👋 @benoitc
I wonder if it would make sense to "intersperse" the addresses here like [ipv6, ipv4, ipv6, ipv4, etc.]?
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.
This change implements the happy eyeballs strategy to bnring better support of IPv6 for hackney. It follows the recommendations iof the RFC 8305. https://datatracker.ietf.org/doc/html/rfc8305
This change allows hackney, to handle the no proxy environnement variable properly. This bbring real full support of proxy setup using environnement.
75b8e72
to
bed3ae3
Compare
062b285
to
420d855
Compare
This pR track different changes to provide a better UX during connection to remote.