Merge pull request #3618 from cesanta/freertos-tcp-sock

Handle no pending connections in FreeRTOS TCP
This commit is contained in:
robertc2000 authored and GitHub committed 2026-07-02 09:38:36 +03:00
commit 6fcf32f203
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;
}