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


##########
net/local/local_netpoll.c:
##########
@@ -161,7 +161,7 @@ int local_pollsetup(FAR struct socket *psock, FAR struct 
pollfd_s *fds)
 
   if (conn->lc_proto == SOCK_DGRAM)
     {
-      return -ENOSYS;
+      return file_poll(&conn->lc_infile, fds, true);

Review Comment:
   Done



##########
net/local/local_conn.c:
##########
@@ -178,6 +178,17 @@ FAR struct local_conn_s *local_alloc(void)
       nxmutex_init(&conn->lc_polllock);
       nxrmutex_init(&conn->lc_conn.s_lock);
 
+      /* Give the connection a unique placeholder path.  local_findconn()
+       * matches on lc_path, so leaving it empty would make every unbound
+       * connection look like every other one, and bind() would reject the
+       * second one with EADDRINUSE.  lc_type stays LOCAL_TYPE_UNNAMED:
+       * the socket has no name until it is bound, and getsockname() and
+       * getpeername() rely on that to report a zero-length sun_path.
+       */
+
+      snprintf(conn->lc_path, sizeof(conn->lc_path),
+               "unnamed.%p", conn);

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