-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
happy eyeballs #11206
happy eyeballs #11206
Conversation
I don't think we can get away with not adding new tests for this. Can you add tests that check it closes connections when it should? Can you add tests that check on_open isn't called for multiple sockets that were attempted? I think there are more cases to handle than that |
packages/bun-usockets/src/context.c
Outdated
*is_connecting = 1; | ||
return (struct us_connecting_socket_t *) us_socket_context_connect_resolved_dns(context, ptr, options, socket_ext_size); | ||
|
||
// with happy eyeballs we can't use the fast path since we need to initiate multiple connections |
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 is not quite accurate
we only should go through the happy eyeballs case when there are multiple results from addrinfo
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.
makes sense, I updated the code to use the fast path when there is a cached addrinfo result that has only one entry
One of the test failures ("request body and signal life cycle" in |
|
|
||
break :brk allocator.dupeZ(u8, raw_host) catch bun.outOfMemory(); | ||
}; | ||
// remove brackets from IPv6 addresses, as getaddrinfo doesn't understand them |
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.
i think there are probably like 10 more cases here to handle btw
What does this PR do?
When connecting a socket we initiate simultaneous connections to all addresses returned by
getaddrinfo
, and keep the first one.How did you verify your code works?
Existing tests.