mirror of
https://github.com/apache/nuttx.git
synced 2026-05-10 07:18:49 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user