Skip to content

Implement RFC 8305 Happy Eyeballs for concurrent connection attempts #225

@coderabbitai

Description

@coderabbitai

Currently, HostName.connect() tries resolved addresses sequentially. When a hostname resolves to multiple addresses (IPv4 and IPv6), this creates user-visible delays if early addresses are unreachable.

RFC 8305 "Happy Eyeballs Version 2" defines an algorithm to race multiple connection attempts concurrently with staggered timing:

  • Dual DNS queries (AAAA and A) with 50ms resolution delay
  • Address interleaving to avoid trying all IPv6 before IPv4
  • Staggered connections with 250ms delay between attempts
  • First successful connection wins, others are cancelled

This would require concurrent I/O primitives to race multiple connection attempts with proper staggering and cancellation.

Related to PR #224 and discussion: #224

Requested by: @lalinsky

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions