You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usock_inet_timeout() does not try all possible ipv6 and ipv4 server addresses if getaddrinfo() returns multiple records on the same family.
Also, it does not allow one to easily differentiate server-not-found (or other getaddrinfo() issue) from connect timeout, from connect refused.
To try all possible servers, one can either attempt to connect() to all of them in parallel (which seems too aggressive), or try to keep one connect() in progress for each family, replacing it with the next possibility should it return ECONNREFUSED, until the timeout expires.
Defining the use of errno should not be a problem, since it was undefined before so it is backwards-compatible:
If getaddrinfo() returns an error, it would be best to return -1, errno=ENOENT.
If none of the servers connect, return ECONNREFUSED if at least one of them returned ECONNREFUSED, or ETIMEDOUT otherwise (i.e. all timed out).
If timeout is zero, we return a socket that is likely to be in-progress and might fail to connect. That's fine, just try IPv6 first.
The text was updated successfully, but these errors were encountered:
hmh:
usock_inet_timeout() does not try all possible ipv6 and ipv4 server addresses if getaddrinfo() returns multiple records on the same family.
Also, it does not allow one to easily differentiate server-not-found (or other getaddrinfo() issue) from connect timeout, from connect refused.
To try all possible servers, one can either attempt to connect() to all of them in parallel (which seems too aggressive), or try to keep one connect() in progress for each family, replacing it with the next possibility should it return ECONNREFUSED, until the timeout expires.
Defining the use of errno should not be a problem, since it was undefined before so it is backwards-compatible:
If getaddrinfo() returns an error, it would be best to return -1, errno=ENOENT.
If none of the servers connect, return ECONNREFUSED if at least one of them returned ECONNREFUSED, or ETIMEDOUT otherwise (i.e. all timed out).
If timeout is zero, we return a socket that is likely to be in-progress and might fail to connect. That's fine, just try IPv6 first.
The text was updated successfully, but these errors were encountered: