From 3aca8c1d8eea25a503154dfd7732773d6074160a Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 22 Nov 2020 23:09:59 +0000 Subject: [PATCH] Guard against libwebsockets assert in 3.2.1 and up. --- src/mux_epoll.c | 4 ++++ src/mux_poll.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/mux_epoll.c b/src/mux_epoll.c index 369db554..32fd1c4c 100644 --- a/src/mux_epoll.c +++ b/src/mux_epoll.c @@ -242,6 +242,10 @@ static void loop_handle_reads_writes(struct mosquitto *context, uint32_t events) socklen_t len; int rc; + if(context->sock == INVALID_SOCKET){ + return; + } + #ifdef WITH_WEBSOCKETS if(context->wsi){ struct lws_pollfd wspoll; diff --git a/src/mux_poll.c b/src/mux_poll.c index b1cba9cf..8e2228ea 100644 --- a/src/mux_poll.c +++ b/src/mux_poll.c @@ -246,6 +246,10 @@ static void loop_handle_reads_writes(struct pollfd *pollfds) continue; } + if(pollfds[context->pollfd_index].fd == INVALID_SOCKET){ + continue; + } + assert(pollfds[context->pollfd_index].fd == context->sock); #ifdef WITH_WEBSOCKETS