mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00: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:
parent
8bb6758490
commit
7a4a6ce4ce
2 changed files with 8 additions and 1 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue