From 442e1c850d12cbd5f0bed7fe46a2eebc32b9386e Mon Sep 17 00:00:00 2001
From: Andy Green <andy.green@linaro.org>
Date: Mon, 29 Feb 2016 10:10:42 +0800
Subject: [PATCH] windows listen for pollhup

After Ondraco

https://github.com/warmcat/libwebsockets/issues/441

Signed-off-by: Andy Green <andy.green@linaro.org>
---
 changelog          | 2 ++
 lib/lws-plat-win.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/changelog b/changelog
index 4580d42a..92035c98 100644
--- a/changelog
+++ b/changelog
@@ -36,6 +36,8 @@ to tell if more headers had arrived.  Result was if the browser didn't
 close the keepalive, we retained ah for the lifetime of the keepalive,
 using up the pool.
 
+8) MAJOR windows-only-POLLHUP was not coming
+
 
 Changes
 -------
diff --git a/lib/lws-plat-win.c b/lib/lws-plat-win.c
index cff09db2..6d731fc0 100644
--- a/lib/lws-plat-win.c
+++ b/lib/lws-plat-win.c
@@ -387,7 +387,8 @@ lws_plat_insert_socket_into_fds(struct lws_context *context, struct lws *wsi)
 
 	pt->fds[pt->fds_count++].revents = 0;
 	pt->events[pt->fds_count] = WSACreateEvent();
-	WSAEventSelect(wsi->sock, pt->events[pt->fds_count], LWS_POLLIN);
+	WSAEventSelect(wsi->sock, pt->events[pt->fds_count],
+		       LWS_POLLIN | LWS_POLLHUP);
 }
 
 LWS_VISIBLE void
-- 
GitLab