This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit a82ee60da8ab35a6426f348cf014ac09b422d0ad
Author: daichuan <[email protected]>
AuthorDate: Thu Aug 28 15:13:09 2025 +0800

    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 <[email protected]>
---
 net/usrsock/usrsock_poll.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/usrsock/usrsock_poll.c b/net/usrsock/usrsock_poll.c
index 9c074d7e3d1..e8c2c697a5d 100644
--- a/net/usrsock/usrsock_poll.c
+++ b/net/usrsock/usrsock_poll.c
@@ -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
     {

Reply via email to