mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-15 10:29:47 +00:00
Merge pull request #3618 from cesanta/freertos-tcp-sock
Handle no pending connections in FreeRTOS TCP
This commit is contained in:
2 files changed
+16
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user