From 1a44e20b6aba246a228ea2cac137f31f726a9cb9 Mon Sep 17 00:00:00 2001 From: Frank May <git+commit@f69m.de> 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/lws-plat-win.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/plat/lws-plat-win.c b/lib/plat/lws-plat-win.c index 6844936f7..bd513b494 100644 --- a/lib/plat/lws-plat-win.c +++ b/lib/plat/lws-plat-win.c @@ -241,6 +241,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--;