robur-coop / happy-eyeballs

An implementation of happy eyeballs (RFC 8305) in OCaml with lwt
ISC License
22 stars 4 forks source link

create: add v6_connect_timeout and resolve_retries #21

Closed hannesm closed 2 years ago

hannesm commented 2 years ago

DNS resolution may fail, by default, retry resolving 3 times (when there's no resolution within resolve_timeout).

The connect_timeout is used for all connection attempts to the last destination. If there is a connection attempt to an IPv6 address (and others are remaining), use v6_connect_timeout (default 200ms) instead. This is the same value as curl. In some network environments, the previously used connect_timeout of one second was not sufficient to establish a complete connection.

hannesm commented 2 years ago

thanks for your review, I addressed your comments in the subsequent commit.

reynir commented 2 years ago

I wonder if we should also retry resolving AAAA in the Waiting_for_aaaa state. With these changes we can have: A resolves first and we wait for AAAA which times out. Then ipv4 connection is attempted, and if it fails we go back to resolving AAAA the remaining resolve retries. After writing this down I think that's what we want - we give resolving AAAA a small window to catch up after resolving A so we can give preference to ipv6, but not so much preference that we will retry resolving entirely.

LGTM