You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/07/07 03:29:00 UTC

[GitHub] [incubator-nuttx] anchao commented on a change in pull request #4080: net/socket: add SO_SNDBUF support

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



##########
File path: net/tcp/tcp_wrbuffer.c
##########
@@ -105,6 +105,44 @@ void tcp_wrbuffer_initialize(void)
   nxsem_set_protocol(&g_wrbuffer.sem, SEM_PRIO_NONE);
 }
 
+/****************************************************************************
+ * Name: tcp_wrbuffer_inqueue_size
+ *
+ * Description:
+ *   Get the in-queued write buffer size from connection
+ *
+ * Input Parameters:
+ *   conn - The TCP connection of interest
+ *
+ * Assumptions:
+ *   Called from user logic with the network locked.
+ *
+ ****************************************************************************/
+
+uint32_t tcp_wrbuffer_inqueue_size(FAR struct tcp_conn_s *conn)
+{
+  FAR struct tcp_wrbuffer_s *wrb;
+  FAR sq_entry_t *entry;
+  uint32_t total = 0;
+
+  if (conn)
+    {
+      for (entry = sq_peek(&conn->unacked_q); entry; entry = sq_next(entry))
+        {
+          wrb = (FAR struct tcp_wrbuffer_s *)entry;
+          total += TCP_WBSENT(wrb);
+        }
+
+      for (entry = sq_peek(&conn->write_q); entry; entry = sq_next(entry))
+        {
+          wrb = (FAR struct tcp_wrbuffer_s *)entry;
+          total += TCP_WBSENT(wrb);

Review comment:
       Done

##########
File path: net/Kconfig
##########
@@ -123,6 +123,12 @@ config NET_RECV_BUFSIZE
 	---help---
 		This is the default value for receive buffer size.
 
+config NET_SEND_BUFSIZE

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

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