Handle no pending connections in FreeRTOS TCP

This commit is contained in:
robert committed 2026-07-02 09:36:58 +03:00
1 parent f055e45755
commit 9879f4d715
2 files changed
+16

No files matched your search

+8
View File
@@ -14062,6 +14062,14 @@ static MG_SOCKET_TYPE raccept(MG_SOCKET_TYPE sock, union usa *usa,
do {
memset(usa, 0, sizeof(*usa));
fd = accept(sock, &usa->sa, len);
#if MG_ENABLE_FREERTOS_TCP
// FreeRTOS_accept() returns NULL to mean "no pending connection",
// therefore we avoid retrying it forever on non-blocking listeners
if (fd == NULL) {
fd = MG_INVALID_SOCKET;
break;
}
#endif
} while (MG_SOCK_INTR(fd));
return fd;
}
+8
View File
@@ -465,6 +465,14 @@ static MG_SOCKET_TYPE raccept(MG_SOCKET_TYPE sock, union usa *usa,
do {
memset(usa, 0, sizeof(*usa));
fd = accept(sock, &usa->sa, len);
#if MG_ENABLE_FREERTOS_TCP
// FreeRTOS_accept() returns NULL to mean "no pending connection",
// therefore we avoid retrying it forever on non-blocking listeners
if (fd == NULL) {
fd = MG_INVALID_SOCKET;
break;
}
#endif
} while (MG_SOCK_INTR(fd));
return fd;
}