From ba8a2f095cb2ae6485eff2a2144b416021019dc4 Mon Sep 17 00:00:00 2001 From: Joe Kilner Date: Tue, 21 Apr 2015 10:41:36 +0100 Subject: [PATCH] Ensure proper cleanup is performed if last websocket is closed. --- lib/pollfd.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/pollfd.c b/lib/pollfd.c index 19905eff..29e14c26 100644 --- a/lib/pollfd.c +++ b/lib/pollfd.c @@ -78,12 +78,7 @@ remove_wsi_socket_from_fds(struct libwebsocket_context *context, lws_libev_io(context, wsi, LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE); - if (!--context->fds_count) { - context->protocols[0].callback(context, wsi, - LWS_CALLBACK_LOCK_POLL, - wsi->user_space, (void *) &pa, 0); - goto do_ext; - } + --context->fds_count; if (wsi->sock > context->max_fds) { lwsl_err("Socket fd %d too high (%d)\n", @@ -117,7 +112,6 @@ remove_wsi_socket_from_fds(struct libwebsocket_context *context, /* removed wsi has no position any more */ wsi->position_in_fds_table = -1; -do_ext: /* remove also from external POLL support via protocol 0 */ if (wsi->sock) { context->protocols[0].callback(context, wsi,