diff --git a/lib/plat/lws-plat-esp32.c b/lib/plat/lws-plat-esp32.c index b5adabe1..58b5281f 100644 --- a/lib/plat/lws-plat-esp32.c +++ b/lib/plat/lws-plat-esp32.c @@ -151,8 +151,9 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi) context->service_tid_detected = context->vhost_list->protocols[0].callback( &_lws, LWS_CALLBACK_GET_THREAD_ID, NULL, NULL, 0); + context->service_tid = context->service_tid_detected; + context->service_tid_detected = 1; } - context->service_tid = context->service_tid_detected; /* * is there anybody with pending stuff that needs service forcing? diff --git a/lib/plat/lws-plat-optee.c b/lib/plat/lws-plat-optee.c index fcd77631..55677af6 100644 --- a/lib/plat/lws-plat-optee.c +++ b/lib/plat/lws-plat-optee.c @@ -111,8 +111,9 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi) context->service_tid_detected = context->vhost_list->protocols[0].callback( &_lws, LWS_CALLBACK_GET_THREAD_ID, NULL, NULL, 0); + context->service_tid = context->service_tid_detected; + context->service_tid_detected = 1; } - context->service_tid = context->service_tid_detected; /* * is there anybody with pending stuff that needs service forcing? diff --git a/lib/plat/lws-plat-unix.c b/lib/plat/lws-plat-unix.c index 74f2af58..068222bb 100644 --- a/lib/plat/lws-plat-unix.c +++ b/lib/plat/lws-plat-unix.c @@ -153,8 +153,9 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi) context->service_tid_detected = context->vhost_list->protocols[0].callback( &_lws, LWS_CALLBACK_GET_THREAD_ID, NULL, NULL, 0); + context->service_tid = context->service_tid_detected; + context->service_tid_detected = 1; } - context->service_tid = context->service_tid_detected; /* * is there anybody with pending stuff that needs service forcing? @@ -171,8 +172,8 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi) n = poll(pt->fds, pt->fds_count, timeout_ms); #ifdef LWS_OPENSSL_SUPPORT - if (!pt->rx_draining_ext_list && - !lws_ssl_anybody_has_buffered_read_tsi(context, tsi) && !n) { + if (!n && !pt->rx_draining_ext_list && + !lws_ssl_anybody_has_buffered_read_tsi(context, tsi)) { #else if (!pt->rx_draining_ext_list && !n) /* poll timeout */ { #endif diff --git a/lib/plat/lws-plat-win.c b/lib/plat/lws-plat-win.c index 864df181..f5b178ce 100644 --- a/lib/plat/lws-plat-win.c +++ b/lib/plat/lws-plat-win.c @@ -178,8 +178,9 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi) context->service_tid_detected = context->vhost_list-> protocols[0].callback(&_lws, LWS_CALLBACK_GET_THREAD_ID, NULL, NULL, 0); + context->service_tid = context->service_tid_detected; + context->service_tid_detected = 1; } - context->service_tid = context->service_tid_detected; if (timeout_ms < 0) {