zhhyu7 commented on code in PR #21403:
URL: https://github.com/apache/nuttx/pull/21403#discussion_r4470232866


##########
net/rpmsg/rpmsg_sockif.c:
##########
@@ -588,15 +732,52 @@ static void rpmsg_socket_ns_bind(FAR struct rpmsg_device 
*rdev,
       return;
     }
 
+  new->server   = server;
+  new->priority = server->priority;
   new->ept.priv = new;
   new->ept.release_cb = rpmsg_socket_ept_release;
+
+  /* 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
+   * able to find this connection on the list.
+   */
+
+  nxmutex_lock(&server->recvlock);
+  if (server->pending >= server->backlog)
+    {
+      /* Reject the connection */
+
+      nerr("Reject the connection, Max listen %d\n", server->backlog);
+      nxmutex_unlock(&server->recvlock);
+      rpmsg_socket_free(new);

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to