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

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

commit 46fd528a42ddd09dc5b29d0fbfaa57778f2242e7
Author: Bowen Wang <[email protected]>
AuthorDate: Thu Jun 25 14:47:26 2026 +0800

    net/rpmsg: fail a blocking connect to an unreachable CPU at once
    
    rpmsg_register_callback() creates the endpoint at once if an rpmsg
    device to the target CPU exists.  If it does not, a blocking connect()
    waited on sendsem until the device appeared or the send timeout expired,
    which with the default timeout means forever.
    
    Return ECONNREFUSED in that case, after the nonblocking check:  a
    nonblocking connect still returns EINPROGRESS and completes from the
    device_created callback once the CPU comes up.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 net/rpmsg/rpmsg_sockif.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c
index 83a15cbd3db..75b13c1dc79 100644
--- a/net/rpmsg/rpmsg_sockif.c
+++ b/net/rpmsg/rpmsg_sockif.c
@@ -1063,6 +1063,11 @@ static int rpmsg_socket_connect_internal(FAR struct 
socket *psock)
           return -EINPROGRESS;
         }
 
+      if (!conn->ept.rdev)
+        {
+          return -ECONNREFUSED;
+        }
+
       ret = net_sem_timedwait(&conn->sendsem,
                               _SO_TIMEOUT(conn->sconn.s_sndtimeo));
       if (!conn->ept.rdev || atomic_read(&conn->unbind))

Reply via email to