Subject: libuv: Fix closing handle multiple times
authorPetar Paradzik <petar.paradzik@sartura.hr>
Fri, 19 May 2017 12:41:03 +0000 (14:41 +0200)
committerAndy Green <andy@warmcat.com>
Tue, 23 May 2017 15:49:14 +0000 (23:49 +0800)
Sometimes "Assertion failed: !uv__is_closing(handle)" happens because
handle is being closed multiple times. To fix this, "uv_is_closing"
is added before calling "uv_close".

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>
lib/libuv.c

index ee6b6e1..e295ee3 100644 (file)
@@ -258,7 +258,8 @@ static void lws_uv_close_cb(uv_handle_t *handle)
 
 static void lws_uv_walk_cb(uv_handle_t *handle, void *arg)
 {
-       uv_close(handle, lws_uv_close_cb);
+       if (!uv_is_closing(handle))
+               uv_close(handle, lws_uv_close_cb);
 }
 
 void