Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[Feature #20646]This is a proposed improvement to
Socket.tcp, which has implemented Happy Eyeballs version 2 (RFC8305) in PR9374.IO.selectwaits for name resolution or connection establishment in v46w, but it does not consider the case where both events occur simultaneously when it returns a value.IO.selectone extra time.IO.selectwaits for both IPv6/IPv4 name resolution (in start), but when it returns a value, it doesn't consider the case where name resolution for both address families is complete.Socket.tcpcan only obtain the addresses of one address family and needs to execute an unnecessary loop obtain the other addresses, callingIO.selectone extra time.connect_timeoutwas insufficient. After initiating one or more connections, it raises a 'user specified timeout' after theconnect_timeoutperiod even if there were addresses that have been resolved and have not yet tried to connect.hostargument.IO.selectIO.select. During the Resolution Delay and Connection Attempt Delay, the user-specified timeout is ignored. Otherwise, the timeout value is set to the larger ofresolv_timeoutandconnect_timeout.connect_timeoutis only detected after attempting to connect to all resolved addresses.tcp_without_fast_fallbackwhen an IP address is passed as the host argument.Additionally, the code has been reduced by over 100 lines, and redundancy has been minimized, which is expected to improve readability.
Before:
After: