You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2020/12/18 05:16:22 UTC
[incubator-nuttx] 02/04: net/tcp/handshake: send the SYN
immediately.
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit ae5b727580df004ee434e1865df54fb8f2bc44a1
Author: chao.an <an...@xiaomi.com>
AuthorDate: Tue Dec 15 20:30:29 2020 +0800
net/tcp/handshake: send the SYN immediately.
Signed-off-by: chao.an <an...@xiaomi.com>
---
net/tcp/tcp_conn.c | 2 +-
net/tcp/tcp_connect.c | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c
index 6a262e2..b16a0cb 100644
--- a/net/tcp/tcp_conn.c
+++ b/net/tcp/tcp_conn.c
@@ -1283,7 +1283,7 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const struct sockaddr *addr)
conn->tx_unacked = 1; /* TCP length of the SYN is one. */
conn->nrtx = 0;
- conn->timer = 1; /* Send the SYN next time around. */
+ conn->timer = 0; /* Send the SYN immediately. */
conn->rto = TCP_RTO;
conn->sa = 0;
conn->sv = 16; /* Initial value of the RTT variance. */
diff --git a/net/tcp/tcp_connect.c b/net/tcp/tcp_connect.c
index 809a48e..d64767f 100644
--- a/net/tcp/tcp_connect.c
+++ b/net/tcp/tcp_connect.c
@@ -41,6 +41,7 @@
#include <nuttx/net/tcp.h>
#include "devif/devif.h"
+#include "netdev/netdev.h"
#include "socket/socket.h"
#include "tcp/tcp.h"
@@ -322,6 +323,10 @@ int psock_tcp_connect(FAR struct socket *psock,
ret = psock_setup_callbacks(psock, &state);
if (ret >= 0)
{
+ /* Notify the device driver that new connection is available. */
+
+ netdev_txnotify_dev(((FAR struct tcp_conn_s *)psock->s_conn)->dev);
+
/* Wait for either the connect to complete or for an error/timeout
* to occur. NOTES: net_lockedwait will also terminate if a signal
* is received.