Skip to content

Commit fd41006

Browse files
committed
fix(mosq): Fix misleading error when accepting connection
Closes #807
1 parent c416976 commit fd41006

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

components/mosquitto/port/net__esp_tls.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
55
*
6-
* SPDX-FileContributor: 2024 Espressif Systems (Shanghai) CO LTD
6+
* SPDX-FileContributor: 2024-2025 Espressif Systems (Shanghai) CO LTD
77
*/
88

99
/*
@@ -106,6 +106,9 @@ struct mosquitto *net__socket_accept(struct mosquitto__listener_sock *listensock
106106

107107
new_sock = accept(listensock->sock, NULL, 0);
108108
if (new_sock == INVALID_SOCKET) {
109+
if (errno == EAGAIN) { // mosquitto tries to accept() in a loop until EAGAIN is returned
110+
return NULL;
111+
}
109112
log__printf(NULL, MOSQ_LOG_ERR,
110113
"Unable to accept new connection, system socket count has been exceeded. Try increasing \"ulimit -n\" or equivalent.");
111114
return NULL;

0 commit comments

Comments
 (0)