Skip to content

Commit

Permalink
smp: extend client to work with tsi
Browse files Browse the repository at this point in the history
and take care of zombie sul previously left on connect failure path
  • Loading branch information
payne.ye authored and lws-team committed Apr 12, 2024
1 parent 5ab6e04 commit ec76f81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/core-net/client/connect3.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ lws_client_connect_3_connect(struct lws *wsi, const char *ads,
*/

lwsi_set_state(wsi, LRS_UNCONNECTED);
lws_sul_schedule(wsi->a.context, 0, &wsi->sul_connect_timeout,
lws_sul_schedule(wsi->a.context, wsi->tsi, &wsi->sul_connect_timeout,
lws_client_dns_retry_timeout,
LWS_USEC_PER_SEC);
return wsi;
Expand Down Expand Up @@ -655,7 +655,7 @@ lws_client_connect_3_connect(struct lws *wsi, const char *ads,
* uses wsi->sul_connect_timeout just for this purpose
*/

lws_sul_schedule(wsi->a.context, 0, &wsi->sul_connect_timeout,
lws_sul_schedule(wsi->a.context, wsi->tsi, &wsi->sul_connect_timeout,
lws_client_conn_wait_timeout,
wsi->a.context->timeout_secs *
LWS_USEC_PER_SEC);
Expand Down Expand Up @@ -801,6 +801,7 @@ lws_client_connect_3_connect(struct lws *wsi, const char *ads,
lws_inform_client_conn_fail(wsi, (void *)cce, strlen(cce));

failed1:
lws_sul_cancel(&wsi->sul_connect_timeout);
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "client_connect3");

return NULL;
Expand Down
4 changes: 2 additions & 2 deletions lib/core-net/client/connect4.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ lws_client_connect_4_established(struct lws *wsi, struct lws *wsi_piggyback,
pfd.revents = LWS_POLLOUT;

lwsl_wsi_info(wsi, "going to service fd");
n = lws_service_fd(wsi->a.context, &pfd);
n = lws_service_fd_tsi(wsi->a.context, &pfd, wsi->tsi);
if (n < 0) {
cce = "first service failed";
goto failed;
Expand Down Expand Up @@ -318,7 +318,7 @@ lws_client_connect_4_established(struct lws *wsi, struct lws *wsi_piggyback,
pfd.events = LWS_POLLIN;
pfd.revents = LWS_POLLIN;

n = lws_service_fd(wsi->a.context, &pfd);
n = lws_service_fd_tsi(wsi->a.context, &pfd, wsi->tsi);
if (n < 0) {
cce = "first service failed";
goto failed;
Expand Down

0 comments on commit ec76f81

Please sign in to comment.