From 3eeda84a8d2dd99333a0313641ec00977f7a6e5b Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 26 Jan 2021 08:04:16 +0000 Subject: [PATCH] http: client: defer HUP if pending buflist --- lib/roles/http/client/client-http.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/roles/http/client/client-http.c b/lib/roles/http/client/client-http.c index 9b7ef9601..2487a3b06 100644 --- a/lib/roles/http/client/client-http.c +++ b/lib/roles/http/client/client-http.c @@ -359,10 +359,14 @@ client_http_body_sent: if ((pollfd->revents & (LWS_POLLIN | LWS_POLLHUP)) == LWS_POLLHUP) { - lwsl_debug("Server conn %s (fd=%d) dead\n", - lws_wsi_tag(wsi), pollfd->fd); - cce = "Peer hung up"; - goto bail3; + if (lws_buflist_total_len(&wsi->buflist)) + lws_set_timeout(wsi, PENDING_TIMEOUT_CLOSE_ACK, 3); + else { + lwsl_debug("Server conn %s (fd=%d) dead\n", + lws_wsi_tag(wsi), pollfd->fd); + cce = "Peer hung up"; + goto bail3; + } } if (pollfd->revents & LWS_POLLOUT)