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



##########
File path: net/tcp/tcp_conn.c
##########
@@ -263,6 +260,20 @@ static FAR struct tcp_conn_s *
 static int tcp_selectport(uint8_t domain, FAR const union ip_addr_u *ipaddr,
                           uint16_t portno)
 {
+  static uint16_t g_last_tcp_port;
+
+  /* Generate port base dynamically */
+
+  if (g_last_tcp_port == 0)
+    {
+      g_last_tcp_port = clock_systime_ticks() % 32000;
+
+      if (g_last_tcp_port < 4096)
+        {
+          g_last_tcp_port += 4096;
+        }
+    }
+

Review comment:
       This can not be completely avoided if the time for creating the port 
between the two OS starts coincides exactly.




----------------------------------------------------------------
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]


Reply via email to