From bd3d8d9de016b1408bee0e6717319e94dc92e048 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 --- 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 5885c66f..983e4860 100644 --- a/lib/output.c +++ b/lib/output.c @@ -278,9 +278,12 @@ LWS_VISIBLE int lws_write(struct lws *wsi, unsigned char *buf, size_t len, if (!lws_state_is_ws(wsi->state) && ((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 9cfb0eba..288f568b 100644 --- a/lib/service.c +++ b/lib/service.c @@ -1591,9 +1591,6 @@ read: break; } - /* all the union members start with hdr, so even in ws mode - * we can deal with the ah via u.hdr - */ if (wsi->ah) { lwsl_info("%s: %p: inherited ah rx\n", __func__, wsi); eff_buf.token_len = wsi->ah->rxlen -