From 027c5d7f6e2ada90588f20436f4d0a8eb21076a8 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 13 Jan 2018 21:10:24 +0000 Subject: [PATCH] Don't remove invalid socket from epoll fd. --- src/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loop.c b/src/loop.c index 8fa5fa5d..500c57bb 100644 --- a/src/loop.c +++ b/src/loop.c @@ -613,7 +613,7 @@ void do_disconnect(struct mosquitto_db *db, struct mosquitto *context) } } #ifdef WITH_EPOLL - if (epoll_ctl(db->epollfd, EPOLL_CTL_DEL, context->sock, &ev) == -1) { + if (context->sock != INVALID_SOCKET && epoll_ctl(db->epollfd, EPOLL_CTL_DEL, context->sock, &ev) == -1) { log__printf(NULL, MOSQ_LOG_DEBUG, "Error in epoll disconnecting: %s", strerror(errno)); } #endif