libuv when in use skip shutdown close phase
authorAndy Green <andy.green@linaro.org>
Mon, 29 Feb 2016 03:11:48 +0000 (11:11 +0800)
committerAndy Green <andy.green@linaro.org>
Mon, 29 Feb 2016 03:11:48 +0000 (11:11 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/libwebsockets.c

index 68edfd9..db855d2 100644 (file)
@@ -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