You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/18 17:30:23 UTC

[nuttx] branch master updated: rpmsg_sockif: block poll shoud not set POLLERR

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


The following commit(s) were added to refs/heads/master by this push:
     new 5bc32727b4 rpmsg_sockif: block poll shoud not set POLLERR
5bc32727b4 is described below

commit 5bc32727b42f8643acebe40c3557b3936a89acac
Author: Bowen Wang <wa...@xiaomi.com>
AuthorDate: Wed Aug 16 17:11:52 2023 +0800

    rpmsg_sockif: block poll shoud not set POLLERR
    
    Support poll rpmsg socket fd with block mode
    
    Signed-off-by: Bowen Wang <wa...@xiaomi.com>
---
 net/rpmsg/rpmsg_sockif.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c
index 5f662d07ca..7fcc0ecf8e 100644
--- a/net/rpmsg/rpmsg_sockif.c
+++ b/net/rpmsg/rpmsg_sockif.c
@@ -918,14 +918,16 @@ static int rpmsg_socket_poll(FAR struct socket *psock,
 
           nxmutex_unlock(&conn->recvlock);
         }
-      else if (!_SS_ISCONNECTED(conn->sconn.s_flags) &&
-               _SS_ISNONBLOCK(conn->sconn.s_flags))
+      else /* !_SS_ISCONNECTED(conn->sconn.s_flags) */
         {
-          ret = OK;
-        }
-      else
-        {
-          eventset |= POLLERR;
+          if (!conn->ept.rdev || conn->unbind)
+            {
+              eventset |= POLLHUP;
+            }
+          else
+            {
+              ret = OK;
+            }
         }
 
       rpmsg_socket_poll_notify(conn, eventset);