From fd410061931b0a48283893ece1913c27c0082f68 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 27 Jun 2025 12:37:52 +0200 Subject: [PATCH] fix(mosq): Fix misleading error when accepting connection Closes https://github.com/espressif/esp-protocols/issues/807 --- components/mosquitto/port/net__esp_tls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/mosquitto/port/net__esp_tls.c b/components/mosquitto/port/net__esp_tls.c index 078a47f9d..cbe771581 100644 --- a/components/mosquitto/port/net__esp_tls.c +++ b/components/mosquitto/port/net__esp_tls.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause * - * SPDX-FileContributor: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2024-2025 Espressif Systems (Shanghai) CO LTD */ /* @@ -106,6 +106,9 @@ struct mosquitto *net__socket_accept(struct mosquitto__listener_sock *listensock new_sock = accept(listensock->sock, NULL, 0); if (new_sock == INVALID_SOCKET) { + if (errno == EAGAIN) { // mosquitto tries to accept() in a loop until EAGAIN is returned + return NULL; + } log__printf(NULL, MOSQ_LOG_ERR, "Unable to accept new connection, system socket count has been exceeded. Try increasing \"ulimit -n\" or equivalent."); return NULL;