From 22227f6015b853f49745178d6257f5afbf2753b2 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 22 Nov 2020 23:12:47 +0000 Subject: [PATCH] Guard against assert in libwebsockets 3.2.1 and up. --- src/loop.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/loop.c b/src/loop.c index 823ffa6f..5835f92b 100644 --- a/src/loop.c +++ b/src/loop.c @@ -721,6 +721,9 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol if(!context) { return; } + if(context->sock == INVALID_SOCKET){ + return; + } for (i=0;i<1;i++) { #else HASH_ITER(hh_sock, db->contexts_by_sock, context, ctxt_tmp){ @@ -728,6 +731,9 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol continue; } + if(pollfds[context->pollfd_index].fd == INVALID_SOCKET){ + continue; + } assert(pollfds[context->pollfd_index].fd == context->sock); #endif