anchao commented on a change in pull request #4071:
URL: https://github.com/apache/incubator-nuttx/pull/4071#discussion_r664541919



##########
File path: net/local/local_sockif.c
##########
@@ -728,6 +731,106 @@ static int local_ioctl(FAR struct socket *psock, int cmd,
   return ret;
 }
 
+/****************************************************************************
+ * Name: local_socketpair
+ *
+ * Description:
+ *   Create a pair of connected sockets between psocks[2]
+ *
+ * Parameters:
+ *   psocks  A reference to the socket structure of the socket pair
+ *
+ ****************************************************************************/
+
+static int local_socketpair(FAR struct socket *psocks[2])
+{
+#if defined(CONFIG_NET_LOCAL_STREAM) || defined(CONFIG_NET_LOCAL_DGRAM)
+  FAR struct local_conn_s *conns[2];
+#ifdef CONFIG_NET_LOCAL_STREAM
+  bool nonblock;
+  int ret;
+#endif /* CONFIG_NET_LOCAL_STREAM */
+  int i;
+
+  for (i = 0; i < 2; i++)
+    {
+      conns[i] = psocks[i]->s_conn;
+      snprintf(conns[i]->lc_path,
+               sizeof(conns[i]->lc_path), "%p", psocks[0]);
+
+      conns[i]->lc_proto = psocks[i]->s_type;
+      conns[i]->lc_type  = LOCAL_TYPE_PATHNAME;
+      conns[i]->lc_state = LOCAL_STATE_BOUND;
+    }
+
+#ifdef CONFIG_NET_LOCAL_DGRAM
+#ifdef CONFIG_NET_LOCAL_STREAM

Review comment:
       if define the UDP without TCP, remove this ifdef will caused compile 
warning "no return value"




-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to