From 980ca50c3936cb8ac03fba03529067d2fff40033 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 29 Feb 2016 11:11:48 +0800 Subject: [PATCH] libuv when in use skip shutdown close phase Signed-off-by: Andy Green --- lib/libwebsockets.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 68edfd9..db855d2 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -308,11 +308,15 @@ just_kill_connection: if (n) lwsl_debug("closing: shutdown ret %d\n", LWS_ERRNO); - lws_change_pollfd(wsi, LWS_POLLOUT, LWS_POLLIN); - wsi->state = LWSS_SHUTDOWN; - lws_set_timeout(wsi, PENDING_TIMEOUT_SHUTDOWN_FLUSH, - context->timeout_secs); - return; + /* libuv: no event available to guarantee completion */ + if (!LWS_LIBUV_ENABLED(context)) { + + lws_change_pollfd(wsi, LWS_POLLOUT, LWS_POLLIN); + wsi->state = LWSS_SHUTDOWN; + lws_set_timeout(wsi, PENDING_TIMEOUT_SHUTDOWN_FLUSH, + context->timeout_secs); + return; + } } #endif -- 2.7.4