1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

connect: erase previous unusability when retrying connect

In the case that we try ipv6 that isn't routable, we get a POLLHUP, that
marks the wsi as unusable (for writes, not pending reads), that's what
we want.

But in the case we go around and retry other dns results that are
routable, we have to clear the wsi unusable flag.  Otherwise we will
connect and find that we can't write on the connection...
This commit is contained in:
Andy Green 2021-03-10 14:50:53 +00:00
parent 27cc9e33e0
commit 0734e1a1cb
2 changed files with 3 additions and 1 deletions

View file

@ -430,7 +430,9 @@ ads_known:
lws_metrics_caliper_bind(wsi->cal_conn, wsi->a.context->mt_conn_tcp);
#endif
wsi->socket_is_permanently_unusable = 0;
m = connect(wsi->desc.sockfd, (const struct sockaddr *)psa, (unsigned int)n);
if (m == -1) {
/*
* Since we're nonblocking, connect not having completed is not

View file

@ -672,7 +672,7 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
* is possible.
*/
if (pollfd->revents & LWS_POLLHUP) {
if ((pollfd->revents & LWS_POLLHUP) == LWS_POLLHUP) {
wsi->socket_is_permanently_unusable = 1;
if (!(pollfd->revents & pollfd->events & LWS_POLLIN)) {