From a43a1bda007d4469279c7dbdda5310c08fb242d9 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 23 Jan 2018 07:01:21 +0800 Subject: [PATCH] close: add LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION allowed to send https://github.com/warmcat/libwebsockets/issues/1159 (cherry picked from commit bd3d8d9de016b1408bee0e6717319e94dc92e048) Conflicts: lib/service.c Change-Id: I298203267526fdf631a6a1660345176c5e8588b8 (cherry picked from commit 354262de94c8c3d9bdd3885ce075c3b81dd7b858) --- lib/output.c | 5 ++++- lib/service.c | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/output.c b/lib/output.c index 465cb5f..c0ad1f8 100644 --- a/lib/output.c +++ b/lib/output.c @@ -315,9 +315,12 @@ LWS_VISIBLE int lws_write(struct lws *wsi, unsigned char *buf, size_t len, if (wsi->state != LWSS_ESTABLISHED && ((wsi->state != LWSS_RETURNED_CLOSE_ALREADY && + wsi->state != LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION && wsi->state != LWSS_AWAITING_CLOSE_ACK) || - wp != LWS_WRITE_CLOSE)) + wp != LWS_WRITE_CLOSE)) { + lwsl_debug("binning\n"); return 0; + } /* if we are continuing a frame that already had its header done */ diff --git a/lib/service.c b/lib/service.c index 2f703f8..1420f58 100644 --- a/lib/service.c +++ b/lib/service.c @@ -1164,9 +1164,6 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, int t break; read: - /* all the union members start with hdr, so even in ws mode - * we can deal with the ah via u.hdr - */ if (wsi->u.hdr.ah) { lwsl_info("%s: %p: inherited ah rx\n", __func__, wsi); eff_buf.token_len = wsi->u.hdr.ah->rxlen - -- 2.7.4