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);