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

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

commit f2d4d5ab4b3e851f2837aa174e7fd52055daaecf
Author: mazhuang <[email protected]>
AuthorDate: Tue May 19 18:38:14 2026 +0800

    net/rpmsg: set the peer address before creating the accepted endpoint
    
    rpmsg_socket_ns_accept() fills new->rpaddr only after
    rpmsg_create_ept() returns.  rpmsg_create_ept() sends the NS ack, and
    the client may answer with its SYNC at once; at RT priority
    rpmsg_socket_ept_cb() handles it right in the rx path, queues the
    connection on the listener and wakes accept(), which then copies an
    empty rpaddr to the caller.
    
    Fill rpaddr before the endpoint is created.
    
    Signed-off-by: mazhuang <[email protected]>
    Signed-off-by: Bowen Wang <[email protected]>
---
 net/rpmsg/rpmsg_sockif.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c
index d1827933f84..a9b55717298 100644
--- a/net/rpmsg/rpmsg_sockif.c
+++ b/net/rpmsg/rpmsg_sockif.c
@@ -901,6 +901,12 @@ static void rpmsg_socket_ns_accept(FAR struct 
rpmsg_socket_conn_s *server,
   new->ept.priv = new;
   new->ept.release_cb = rpmsg_socket_ept_release;
 
+  new->rpaddr.rp_family = AF_RPMSG;
+  strlcpy(new->rpaddr.rp_cpu, rpmsg_get_cpuname(rdev),
+          sizeof(new->rpaddr.rp_cpu));
+  strlcpy(new->rpaddr.rp_name, name + RPMSG_SOCKET_NAME_PREFIX_LEN,
+          sizeof(new->rpaddr.rp_name));
+
   /* Take the backlog slot and join the listener's pending list before the
    * endpoint exists.  rpmsg_create_ept() sends the NS ack, after which the
    * remote may answer with its SYNC at once;  the handler must already be
@@ -959,12 +965,6 @@ static void rpmsg_socket_ns_accept(FAR struct 
rpmsg_socket_conn_s *server,
       goto errout_with_pending;
     }
 
-  new->rpaddr.rp_family = AF_RPMSG;
-  strlcpy(new->rpaddr.rp_cpu, rpmsg_get_cpuname(rdev),
-          sizeof(new->rpaddr.rp_cpu));
-  strlcpy(new->rpaddr.rp_name, name + RPMSG_SOCKET_NAME_PREFIX_LEN,
-          sizeof(new->rpaddr.rp_name));
-
   rpmsg_socket_ns_bound(&new->ept);
   return;
 

Reply via email to