addrinfo *base_ai = ai;
// Connect to everything in turn until we have a socket.
- while (ai && !should_stop()) {
+ for ( ; ai && !should_stop(); ai = ai->ai_next) {
int sock = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP);
if (sock == -1) {
// Could be e.g. EPROTONOSUPPORT. The show must go on.
}
safe_close(sock);
- ai = ai->ai_next;
}
// Give the last one as error.