diff --git a/lib/core-net/service.c b/lib/core-net/service.c index 672d5081c..8338d3dc7 100644 --- a/lib/core-net/service.c +++ b/lib/core-net/service.c @@ -714,8 +714,8 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, case LWS_HPI_RET_HANDLED: break; case LWS_HPI_RET_PLEASE_CLOSE_ME: - lwsl_notice("%s: %s pollin says please close me\n", __func__, - wsi->role_ops->name); + //lwsl_notice("%s: %s pollin says please close me\n", __func__, + // wsi->role_ops->name); close_and_handled: lwsl_debug("%p: Close and handled\n", wsi); lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, diff --git a/lib/roles/http/client/client-handshake.c b/lib/roles/http/client/client-handshake.c index a2425b0a7..4e1641459 100644 --- a/lib/roles/http/client/client-handshake.c +++ b/lib/roles/http/client/client-handshake.c @@ -375,6 +375,7 @@ lws_client_connect_3_connect(struct lws *wsi, const char *ads, LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY | LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE); #endif + struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi]; const struct sockaddr *psa = NULL; uint16_t port = wsi->c_port; const char *cce, *iface; @@ -652,8 +653,12 @@ ads_known: if (wsi->a.context->event_loop_ops->sock_accept(wsi)) goto try_next_result_closesock; - if (__insert_wsi_socket_into_fds(wsi->a.context, wsi)) + lws_pt_lock(pt, __func__); + if (__insert_wsi_socket_into_fds(wsi->a.context, wsi)) { + lws_pt_unlock(pt); goto try_next_result_closesock; + } + lws_pt_unlock(pt); /* * The fd + wsi combination is entered into the wsi tables diff --git a/lib/roles/http/client/client-http.c b/lib/roles/http/client/client-http.c index 015a23479..3f535cc55 100644 --- a/lib/roles/http/client/client-http.c +++ b/lib/roles/http/client/client-http.c @@ -508,6 +508,7 @@ bail3: int LWS_WARN_UNUSED_RESULT lws_http_transaction_completed_client(struct lws *wsi) { + struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi]; int n; lwsl_info("%s: wsi: %p (%s)\n", __func__, wsi, wsi->a.protocol->name); @@ -526,7 +527,9 @@ lws_http_transaction_completed_client(struct lws *wsi) * For h1, wsi may pass some assets on to a queued child and be * destroyed during this. */ + lws_pt_lock(pt, __func__); n = _lws_generic_transaction_completed_active_conn(&wsi, 1); + lws_pt_unlock(pt); if (wsi->http.ah) { if (wsi->client_mux_substream)