From 2cddfc963be2aba0bb898c221d119a28d383a731 Mon Sep 17 00:00:00 2001 From: Frank May Date: Sun, 19 Aug 2018 06:43:31 +0800 Subject: [PATCH] windows: fix timeout between writes on Windows After servicing a writable socket, we need to set timeout_ms to zero. This makes WSAWaitForMultipleEvents() return immediately after checking events. --- lib/plat/windows/windows-service.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/plat/windows/windows-service.c b/lib/plat/windows/windows-service.c index 9422a0b29..cf8c9a388 100644 --- a/lib/plat/windows/windows-service.c +++ b/lib/plat/windows/windows-service.c @@ -90,6 +90,10 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi) n = lws_service_fd(context, pfd); if (n < 0) return -1; + + /* Force WSAWaitForMultipleEvents() to check events and then return immediately. */ + timeout_ms = 0; + /* if something closed, retry this slot */ if (n) i--;