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 2023/01/17 18:12:49 UTC
[nuttx] branch master updated: net/tcp: move drop send source code to correct place
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/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new fa6ba05097 net/tcp: move drop send source code to correct place
fa6ba05097 is described below
commit fa6ba05097f144c8d943d2e7bea298f17236e690
Author: chao an <an...@xiaomi.com>
AuthorDate: Tue Jan 17 19:52:02 2023 +0800
net/tcp: move drop send source code to correct place
Merge conflicts lead to code being placed in thre wrong place
The debug code should placed in tcp_send() not tcp_synack()
Signed-off-by: chao an <an...@xiaomi.com>
---
net/tcp/tcp_send.c | 56 +++++++++++++++++++++++++++---------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/net/tcp/tcp_send.c b/net/tcp/tcp_send.c
index 1cf14ec894..db3d38835e 100644
--- a/net/tcp/tcp_send.c
+++ b/net/tcp/tcp_send.c
@@ -279,6 +279,34 @@ void tcp_send(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
dev->d_len = len;
tcp->tcpoffset = (TCP_HDRLEN / 4) << 4;
tcp_sendcommon(dev, conn, tcp);
+
+#if defined(CONFIG_NET_STATISTICS) && \
+ defined(CONFIG_NET_TCP_DEBUG_DROP_SEND)
+
+#pragma message \
+ "CONFIG_NET_TCP_DEBUG_DROP_SEND is selected, this is debug " \
+ "feature to drop the tcp send packet on the floor, " \
+ "please confirm the configuration again if you do not want " \
+ "debug the TCP stack."
+
+ /* Debug feature to drop the tcp received packet on the floor */
+
+ if ((flags & TCP_PSH) != 0)
+ {
+ if ((g_netstats.tcp.sent %
+ CONFIG_NET_TCP_DEBUG_DROP_SEND_PROBABILITY) == 0)
+ {
+ uint32_t seq = tcp_getsequence(tcp->seqno);
+
+ ninfo("TCP DROP SNDPKT: "
+ "[%d][%" PRIu32 " : %" PRIu32 " : %d]\n",
+ g_netstats.tcp.sent, seq, TCP_SEQ_ADD(seq, dev->d_sndlen),
+ dev->d_sndlen);
+
+ dev->d_len = 0;
+ }
+ }
+#endif
}
/****************************************************************************
@@ -575,34 +603,6 @@ void tcp_synack(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
/* Complete the common portions of the TCP message */
tcp_sendcommon(dev, conn, tcp);
-
-#if defined(CONFIG_NET_STATISTICS) && \
- defined(CONFIG_NET_TCP_DEBUG_DROP_SEND)
-
-#pragma message \
- "CONFIG_NET_TCP_DEBUG_DROP_SEND is selected, this is debug " \
- "feature to drop the tcp send packet on the floor, " \
- "please confirm the configuration again if you do not want " \
- "debug the TCP stack."
-
- /* Debug feature to drop the tcp received packet on the floor */
-
- if ((flags & TCP_PSH) != 0)
- {
- if ((g_netstats.tcp.sent %
- CONFIG_NET_TCP_DEBUG_DROP_SEND_PROBABILITY) == 0)
- {
- uint32_t seq = tcp_getsequence(tcp->seqno);
-
- ninfo("TCP DROP SNDPKT: "
- "[%d][%" PRIu32 " : %" PRIu32 " : %d]\n",
- g_netstats.tcp.sent, seq, TCP_SEQ_ADD(seq, dev->d_sndlen),
- dev->d_sndlen);
-
- dev->d_len = 0;
- }
- }
-#endif
}
/****************************************************************************