diff --git a/lib/core-net/client/connect.c b/lib/core-net/client/connect.c index 4c632b504..889bc8057 100644 --- a/lib/core-net/client/connect.c +++ b/lib/core-net/client/connect.c @@ -87,12 +87,8 @@ lws_client_connect_via_info(const struct lws_client_connect_info *i) const struct lws_protocols *p; const char *cisin[CIS_COUNT]; struct lws_vhost *vh, *v; - int -#if LWS_MAX_SMP > 1 - tid = 0, -#endif - n, tsi = 0; size_t size; + int n, tsi; char *pc; if (i->context->requested_stop_internal_loops) @@ -114,23 +110,8 @@ lws_client_connect_via_info(const struct lws_client_connect_info *i) * PHASE 1: if SMP, find out the tsi related to current service thread */ -#if LWS_MAX_SMP > 1 - - for (n = 0; n < i->context->count_threads; n++) - if (i->context->pt[n].service_tid == tid) { - lwsl_info("%s: client binds to caller tsi %d\n", - __func__, n); - tsi = n; - - break; - } - - /* - * this binding is sort of provisional, since when we try to insert - * into the pt fds, there may be no space and it will fail - */ - -#endif + tsi = lws_pthread_self_to_tsi(i->context); + assert(tsi >= 0); /* PHASE 2: create a bare wsi */ @@ -237,11 +218,6 @@ lws_client_connect_via_info(const struct lws_client_connect_info *i) goto bail; } -#if LWS_MAX_SMP > 1 - tid = wsi->a.vhost->protocols[0].callback(wsi, - LWS_CALLBACK_GET_THREAD_ID, NULL, NULL, 0); -#endif - /* * PHASE 3: Choose an initial role for the wsi and do role-specific init * diff --git a/lib/core/libwebsockets.c b/lib/core/libwebsockets.c index 4def85638..ee7c1e103 100644 --- a/lib/core/libwebsockets.c +++ b/lib/core/libwebsockets.c @@ -234,6 +234,10 @@ lws_pthread_self_to_tsi(struct lws_context *context) struct lws_context_per_thread *pt = &context->pt[0]; int n; + /* case that we have SMP build, but don't use it */ + if (context->count_threads == 1) + return 0; + for (n = 0; n < context->count_threads; n++) { if (pthread_equal(ps, pt->self)) return n; diff --git a/lib/plat/windows/windows-init.c b/lib/plat/windows/windows-init.c index f60c8bfe4..43956b433 100644 --- a/lib/plat/windows/windows-init.c +++ b/lib/plat/windows/windows-init.c @@ -117,7 +117,7 @@ lws_plat_context_late_destroy(struct lws_context *context) #ifdef LWS_WITH_PLUGINS if (context->plugin_list) - lws_plugins_destroy(&context->plugin_list); + lws_plugins_destroy(&context->plugin_list, NULL, NULL); #endif for (n = 0; n < FD_HASHTABLE_MODULUS; n++) {