mirror of https://git.code.sf.net/p/isync/isync
Browse Source
The `socket_connect_one` function previously did an `exit(1)` when encountering any errors with opening the socket. This would break connecting to a host where multiple possible addrinfos are returned, where the leading addrinfos are in fact impossible to connect to. E.g. with a kernel configured without support for IPv6, the `getaddrinfo` call may still return a hint containing an IPv6 address alongside another hint with an IPv4 address. Creating the socket with the IPv6 address, which will cause an error, lead us to exiting early without even trying remaining hints. While one can argue that the user should have compiled without HAVE_IPV6 or used an appropriate DNS configuration, we can do better by simply skipping over the current addrinfo causing an error. To do so, we split out a new function `socket_connect_next`, which selects the next available address info and subsequently calls `socket_connect_one` again. When no hints remain, `sock_connect_one` will error out at that point.1.2
Patrick Steinhardt
7 years ago
committed by
Oswald Buddenhagen
1 changed files with 11 additions and 4 deletions
Loading…
Reference in new issue