diff --git a/changelog b/changelog index be8c81724aa6a1d65a3b67737b8ebaa89f731fd1..db66e9d4a62ee3d7ac386ce8f28fd3ad5e169cfc 100644 --- a/changelog +++ b/changelog @@ -13,6 +13,10 @@ it. attack.sh updated to add a test for this. 3) MINOR An error about hdr struct in _lws_ws_related is corrected, it's not known to affect anything until after it was fixed +4) MINOR During the close shutdown wait state introduced at v1.7, if something +requests callback on writeable for the socket it will busywait until the +socket closes + Changes ------- diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 26d8868e744d06d9f6e2f30a86520980b73c2250..b4bac9f3d48aede61aa02cbf9d4b8c338501f5f9 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -299,8 +299,9 @@ just_kill_connection: n = shutdown(wsi->sock, SHUT_WR); if (n) lwsl_debug("closing: shutdown ret %d\n", LWS_ERRNO); - wsi->state = LWSS_SHUTDOWN; + lws_change_pollfd(wsi, LWS_POLLOUT, LWS_POLLIN); + wsi->state = LWSS_SHUTDOWN; lws_set_timeout(wsi, PENDING_TIMEOUT_SHUTDOWN_FLUSH, context->timeout_secs); return; diff --git a/lib/pollfd.c b/lib/pollfd.c index fb86fbd4d100144c58ce7964a10fb05ddeb0a132..65a28e4155e30b28e614b717730ad9538f7e1c33 100644 --- a/lib/pollfd.c +++ b/lib/pollfd.c @@ -277,7 +277,12 @@ lws_callback_on_writable(struct lws *wsi) #ifdef LWS_USE_HTTP2 struct lws *network_wsi, *wsi2; int already; +#endif + + if (wsi->state == LWSS_SHUTDOWN) + return 0; +#ifdef LWS_USE_HTTP2 lwsl_info("%s: %p\n", __func__, wsi); if (wsi->mode != LWSCM_HTTP2_SERVING)