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



##########
File path: net/usrsock/usrsock_conn.c
##########
@@ -94,23 +97,36 @@ static void _usrsock_semgive(FAR sem_t *sem)
 FAR struct usrsock_conn_s *usrsock_alloc(void)
 {
   FAR struct usrsock_conn_s *conn;
+#ifdef CONFIG_NET_ALLOC_CONNS
+  int i;
+#endif
 
   /* The free list is protected by a semaphore (that behaves like a mutex). */
 
   _usrsock_semtake(&g_free_sem);
+#ifdef CONFIG_NET_ALLOC_CONNS
+  if (dq_peek(&g_free_usrsock_connections) == NULL)
+    {
+      conn = kmm_zalloc(sizeof(*conn) * CONFIG_NET_USRSOCK_CONNS);
+      if (conn != NULL)
+        {
+          for (i = 0; i < CONFIG_NET_USRSOCK_CONNS; i++)
+            {
+              dq_addlast(&conn[i].node, &g_free_usrsock_connections);
+            }
+        }
+    }
+#endif

Review comment:
       Yes, we do not check the limit in the case of NET_ALLOC_CONNS enabled,
   The limitation of connections will be implement from the VFS layer:
   
   ```
   _POSIX_OPEN_MAX
   RLIMIT_NOFILE
   ```




-- 
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