From 86819f05af9fa70b23ec8107f6885b756ccfc0a2 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 25 Sep 2024 07:10:54 +0100 Subject: [PATCH] win32: upscale timeout_ms to 64-bit int This may help with this: https://github.com/warmcat/libwebsockets/issues/3201 --- lib/plat/windows/windows-service.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/plat/windows/windows-service.c b/lib/plat/windows/windows-service.c index b56ef43de..e9399c957 100644 --- a/lib/plat/windows/windows-service.c +++ b/lib/plat/windows/windows-service.c @@ -63,6 +63,7 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi) struct lws_context_per_thread *pt; struct lws_pollfd *pfd; lws_usec_t timeout_us; + int64_t timeout_ms64 = (int64_t)timeout_ms; struct lws *wsi; unsigned int i; int n; @@ -85,12 +86,12 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi) pt->service_tid_detected = 1; } - if (timeout_ms < 0) - timeout_ms = 0; + if (timeout_ms64 < 0) + timeout_ms64 = 0; else /* force a default timeout of 23 days */ - timeout_ms = 2000000000; - timeout_us = ((lws_usec_t)timeout_ms) * LWS_US_PER_MS; + timeout_ms64 = 2000000000; + timeout_us = ((lws_usec_t)timeout_ms64) * LWS_US_PER_MS; if (context->event_loop_ops->run_pt) context->event_loop_ops->run_pt(context, tsi);