From 5bc32727b42f8643acebe40c3557b3936a89acac Mon Sep 17 00:00:00 2001 From: Bowen Wang Date: Wed, 16 Aug 2023 17:11:52 +0800 Subject: [PATCH] rpmsg_sockif: block poll shoud not set POLLERR Support poll rpmsg socket fd with block mode Signed-off-by: Bowen Wang --- 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);