You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/06/30 11:39:24 UTC

[incubator-nuttx] 01/03: tcp_close: replace scaring comments

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 8472430f22e3191a19a78ed2d862ca6eb41a99c4
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Jun 29 19:18:00 2021 +0900

    tcp_close: replace scaring comments
---
 net/tcp/tcp_close.c | 14 +-------------
 net/tcp/tcp_conn.c  |  4 ++--
 2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/net/tcp/tcp_close.c b/net/tcp/tcp_close.c
index bfad4df..bd421c9 100644
--- a/net/tcp/tcp_close.c
+++ b/net/tcp/tcp_close.c
@@ -266,19 +266,7 @@ static inline int tcp_close_disconnect(FAR struct socket *psock)
   /* If we have a semi-permanent write buffer callback in place, then
    * is needs to be be nullified.
    *
-   * Commit f1ef2c6cdeb032eaa1833cc534a63b50c5058270:
-   * "When a socket is closed, it should make sure that any pending write
-   *  data is sent before the FIN is sent.  It already would wait for all
-   *  sent data to be acked, however it would discard any pending write
-   *  data that had not been sent at least once.
-   *
-   * "This change adds a check for pending write data in addition to unacked
-   *  data.  However, to be able to actually send any new data, the send
-   *  callback must be left.  The callback should be freed later when the
-   *  socket is actually destroyed."
-   *
-   * REVISIT:  Where and how exactly is s_sndcb ever freed?  Is there a
-   * memory leak here?
+   * Note: the callback will be freed by tcp_free.
    */
 
   psock->s_sndcb = NULL;
diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c
index fdfd6df..d78d7f1 100644
--- a/net/tcp/tcp_conn.c
+++ b/net/tcp/tcp_conn.c
@@ -703,8 +703,8 @@ void tcp_free(FAR struct tcp_conn_s *conn)
   DEBUGASSERT(conn->crefs == 0);
   net_lock();
 
-  /* Free remaining callbacks, actually there should be only the close
-   * callback left.
+  /* Free remaining callbacks, actually there should be only the send
+   * callback for CONFIG_NET_TCP_WRITE_BUFFERS is left.
    */
 
   for (cb = conn->list; cb; cb = next)