anchao commented on a change in pull request #3100:
URL: https://github.com/apache/incubator-nuttx/pull/3100#discussion_r597806402
##########
File path: net/tcp/tcp_conn.c
##########
@@ -1133,42 +1133,49 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const
struct sockaddr *addr)
net_lock();
+ /* Check if the local port has been bind() */
+
+ port = conn->lport;
+
+ if (port == 0)
+ {
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
- if (conn->domain == PF_INET)
+ if (conn->domain == PF_INET)
#endif
- {
- /* Select a port that is unique for this IPv4 local address (host
- * order).
- */
+ {
+ /* Select a port that is unique for this IPv4 local address (host
+ * order).
+ */
- port = tcp_selectport(PF_INET,
- (FAR const union ip_addr_u *)&conn->u.ipv4.laddr,
- ntohs(conn->lport));
- }
+ port = tcp_selectport(PF_INET,
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.
For queries about this service, please contact Infrastructure at:
[email protected]