From ec76f8178dde74d9c9f485e0e2ff609a0b8ec1f4 Mon Sep 17 00:00:00 2001 From: "payne.ye" Date: Fri, 12 Apr 2024 09:49:37 +0800 Subject: [PATCH] smp: extend client to work with tsi and take care of zombie sul previously left on connect failure path --- lib/core-net/client/connect3.c | 5 +++-- lib/core-net/client/connect4.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/core-net/client/connect3.c b/lib/core-net/client/connect3.c index b8a0aa5ce6..8128d85181 100644 --- a/lib/core-net/client/connect3.c +++ b/lib/core-net/client/connect3.c @@ -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; @@ -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); @@ -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; diff --git a/lib/core-net/client/connect4.c b/lib/core-net/client/connect4.c index c34d2253be..d96ba7c5c6 100644 --- a/lib/core-net/client/connect4.c +++ b/lib/core-net/client/connect4.c @@ -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; @@ -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;