From 3bf3b540ad8f386095d8fe95ac9b1fe78afcf8e1 Mon Sep 17 00:00:00 2001 From: "terry.lu" Date: Wed, 27 Jan 2021 15:56:23 +0800 Subject: [PATCH] windows: pipe: avoid busy loop in windows pipe event --- lib/roles/pipe/ops-pipe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/roles/pipe/ops-pipe.c b/lib/roles/pipe/ops-pipe.c index d37d54b3c..0754d0c27 100644 --- a/lib/roles/pipe/ops-pipe.c +++ b/lib/roles/pipe/ops-pipe.c @@ -51,6 +51,13 @@ rops_handle_POLLIN_pipe(struct lws_context_per_thread *pt, struct lws *wsi, (void)n; if (n < 0) return LWS_HPI_RET_PLEASE_CLOSE_ME; +#elif defined(WIN32) + char s[100]; + int n; + + n = recv(wsi->desc.sockfd, s, sizeof(s), 0); + if (n == SOCKET_ERROR) + return LWS_HPI_RET_PLEASE_CLOSE_ME; #endif #if defined(LWS_WITH_THREADPOOL)