From e1cdb1f328e83e3dabf3c21b1017ac5fb73b3683 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 24 Nov 2017 12:18:49 +0800 Subject: [PATCH] close: make sure all paths capture original state --- lib/libwebsockets.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index e9fcb5af..b8a49947 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -402,6 +402,8 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason) goto async_close; } + wsi->state_pre_close = wsi->state; + #ifdef LWS_WITH_CGI if (wsi->mode == LWSCM_CGI) { /* we are not a network connection, but a handler for CGI io */ @@ -446,8 +448,6 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason) wsi->state == LWSS_SHUTDOWN) goto just_kill_connection; - wsi->state_pre_close = wsi->state; - switch (wsi->state_pre_close) { case LWSS_DEAD_SOCKET: return;