diff --git a/lib/core-net/private-lib-core-net.h b/lib/core-net/private-lib-core-net.h index 0898c2f97..b4ae0d82b 100644 --- a/lib/core-net/private-lib-core-net.h +++ b/lib/core-net/private-lib-core-net.h @@ -751,6 +751,7 @@ struct lws { #endif #if defined(LWS_WITH_CLIENT) char chunk_parser; /* enum lws_chunk_parser */ + uint8_t addrinfo_idx; #endif #if defined(LWS_WITH_CGI) || defined(LWS_WITH_CLIENT) char reason_bf; /* internal writeable callback reason bitfield */ diff --git a/lib/roles/http/client/client-handshake.c b/lib/roles/http/client/client-handshake.c index 688f9bf5b..eb4d6dca0 100644 --- a/lib/roles/http/client/client-handshake.c +++ b/lib/roles/http/client/client-handshake.c @@ -260,6 +260,7 @@ lws_client_connect_3_connect(struct lws *wsi, const char *ads, #endif #endif + /* * async dns calls back here for everybody who cares when it gets a * result... but if we are piggybacking, we do not want to connect @@ -554,6 +555,7 @@ ads_known: m = connect(wsi->desc.sockfd, (const struct sockaddr *)psa, n); if (m == -1) { + lwsl_debug("%s: connect says errno: %d\n", __func__, LWS_ERRNO); if (LWS_ERRNO != LWS_EALREADY && @@ -597,7 +599,6 @@ conn_good: return lws_client_connect_4_established(wsi, NULL, plen); - oom4: if (lwsi_role_client(wsi) && wsi->protocol /* && lwsi_state_est(wsi) */) lws_inform_client_conn_fail(wsi,(void *)cce, strlen(cce)); @@ -623,6 +624,7 @@ oom4: return NULL; + try_next_result_fds: wsi->oom4 = 0; __remove_wsi_socket_from_fds(wsi); @@ -763,6 +765,8 @@ lws_client_connect_2_dnsreq(struct lws *wsi) create_new_conn: #endif + wsi->addrinfo_idx = 0; + /* * clients who will create their own fresh connection keep a copy of * the hostname they originally connected to, in case other connections