usrsock: Avoid frequent POLLIN when remote close during accept.

Clear USRSOCK_EVENT_RECVFROM_AVAIL flag when remote closes connection during accept to prevent repeated POLLIN events and EPIPE loop.

Signed-off-by: daichuan <daichuan@xiaomi.com>
This commit is contained in:
daichuan
2025-08-26 19:44:29 +08:00
committed by Xiang Xiao
parent 8bb6758490
commit 7a4a6ce4ce
2 changed files with 8 additions and 1 deletions
+1
View File
@@ -297,6 +297,7 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
{
ninfo("usockid=%d; remote closed (EOF).\n", conn->usockid);
conn->flags &= ~USRSOCK_EVENT_RECVFROM_AVAIL;
ret = -EPIPE;
goto errout_free_conn;
}
+7 -1
View File
@@ -83,7 +83,13 @@ static uint32_t poll_event(FAR struct net_driver_s *dev,
/* Remote closed. */
eventset |= (POLLHUP | POLLIN);
eventset |= POLLHUP;
if (flags & USRSOCK_EVENT_RECVFROM_AVAIL)
{
ninfo("socket recv avail.\n");
eventset |= POLLIN;
}
}
else
{