usrsock: Check RECVFROM_AVAIL before setting POLLIN in pollsetup

In usrsock_pollsetup, only set POLLIN if USRSOCK_EVENT_RECVFROM_AVAIL is set when remote is closed, avoiding invalid POLLIN events.

Signed-off-by: daichuan <daichuan@xiaomi.com>
This commit is contained in:
daichuan 2025-08-28 15:13:09 +08:00 committed by Xiang Xiao
parent 7a4a6ce4ce
commit a82ee60da8

View file

@ -223,7 +223,13 @@ static int usrsock_pollsetup(FAR struct socket *psock,
/* Remote closed. */
eventset |= (POLLHUP | POLLIN);
eventset |= POLLHUP;
if (conn->flags & USRSOCK_EVENT_RECVFROM_AVAIL)
{
ninfo("socket recv avail.\n");
eventset |= POLLIN;
}
}
else
{