Skip to content

Update EndpointOrdering Happy Eyeballs Logic - #348

Open
gakiwate wants to merge 2 commits into
apple:mainfrom
gakiwate:happy-eyeballs-core
Open

gakiwate wants to merge 2 commits into
apple:mainfrom
gakiwate:happy-eyeballs-core

Conversation

@gakiwate

Copy link
Copy Markdown
Contributor
  • orderEndpoints takes a destination comparator, a connection-use reader and a randomness source; each defaults to a built-in or a no-op.
  • Add PriorityOrigin: a priority of 0 means "none supplied" for a service binding, and the most preferred value for SRV.
  • Add orderBySRVWeight, the RFC 2782 weight-proportional draw within each priority group.
  • Add preferConnectedOrder, moving the endpoint with the most established use to the front.
  • Endpoint.priority and .weight gain setters.
  • Default Preferred Address Family Count is now 2.
  • Move the IPv6 prefix predicates to IPv6Address.swift.

- orderEndpoints takes a destination comparator, a connection-use reader
  and a randomness source; each defaults to a built-in or a no-op.
- Add PriorityOrigin: a priority of 0 means "none supplied" for a service
  binding, and the most preferred value for SRV.
- Add orderBySRVWeight, the RFC 2782 weight-proportional draw within each
  priority group.
- Add preferConnectedOrder, moving the endpoint with the most established
  use to the front.
- Endpoint.priority and .weight gain setters.
- Default Preferred Address Family Count is now 2.
- Move the IPv6 prefix predicates to IPv6Address.swift.
@gakiwate gakiwate added the 🆕 semver/minor Adds new public API. label Nov 13, 2026

// MARK: Grouping by application protocol and security requirements

// Not implemented: no endpoint carries ALPN values or security parameters. Its groups are

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think should remain "not implemented", but should instead be passed in by the caller when it is known.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed it. We now have a ProtocolGroupRanker function that gets passed in similar to the others.

- Add protocolGroups and orderEndpointGroups. Groups are alternatives, so
  they are returned as separate lists rather than one, and an endpoint
  usable over two protocols is offered in both.
- Run the SRV weighted draw before prefer-connected, which moves an entry
  to the front and would otherwise split the contiguous priority runs the
  draw reads.
- An endpoint with no IP family, a Unix-domain one included, holds its
  slot instead of disqualifying its whole run from interleaving.
- Name the default Preferred Address Family Count as a constant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants