cf-ip-happy: limit concurrent attempts

Introduce a limit on the concurrent connect attempts of 6:

- document this in CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS
- close the oldest attempt before opening a new one that would
  exceed the limit
- closing failed attempts early to avoid sockets use beyong their
  usefulness
- add tests for limits in unit2600

These changes are externally visible as file descriptors will be
reassigned where we previously kept the old one around and started a
new socket, allocating always a new descriptor.

Closes #21252
This commit is contained in:
Stefan Eissing 2026-04-07 11:57:37 +02:00 committed by Daniel Stenberg
parent 44c19a2cce
commit db9b6fa82e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 104 additions and 29 deletions

View file

@ -65,6 +65,12 @@ anything back). That took 3 times the happy eyeballs timeout, so 600ms
in the default setting. When any of those four report a success, that
socket is used for the transfer and the other three are closed.
There is a limit on the number of sockets opened for connect attempts. When
that limit is reached and more addresses are available, the oldest
attempt is discarded. This limit is currently 6. With the default
happy eyeballs timeout of 200ms, this closes attempts after 1.2 seconds
*as long as there are more addresses to try*.
There are situations where connect attempts fail, but the failure is
considered being inconclusive. The QUIC protocol may encounter this.
When a QUIC server restarts, it may send replies indicating that it