From b156268521c86ef520f1163fcc769e210cc1d0e1 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sun, 23 May 2021 14:45:37 +0100 Subject: [PATCH] sse: server: handle close found as HUP --- lib/roles/h1/ops-h1.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/roles/h1/ops-h1.c b/lib/roles/h1/ops-h1.c index a6e53e40c..6a22df835 100644 --- a/lib/roles/h1/ops-h1.c +++ b/lib/roles/h1/ops-h1.c @@ -632,6 +632,11 @@ rops_handle_POLLIN_h1(struct lws_context_per_thread *pt, struct lws *wsi, lwsl_debug("%s: %s: wsistate 0x%x\n", __func__, lws_wsi_tag(wsi), (unsigned int)wsi->wsistate); + + if (pollfd->revents & LWS_POLLHUP && + !lws_buflist_total_len(&wsi->buflist)) + return LWS_HPI_RET_PLEASE_CLOSE_ME; + n = lws_h1_server_socket_service(wsi, pollfd); if (n != LWS_HPI_RET_HANDLED) return n;