anchao commented on a change in pull request #3100:
URL: https://github.com/apache/incubator-nuttx/pull/3100#discussion_r597806243
##########
File path: net/tcp/tcp_conn.c
##########
@@ -285,19 +286,18 @@ static int tcp_selectport(uint8_t domain, FAR const union
ip_addr_u *ipaddr,
do
{
/* Guess that the next available port number will be the one after
- * the last port number assigned.
+ * the last port number assigned. Make sure that the port number
+ * is within range.
*/
- portno = ++g_last_tcp_port;
-
- /* Make sure that the port number is within range */
-
- if (g_last_tcp_port >= 32000)
+ if (++g_last_tcp_port >= 32000)
{
g_last_tcp_port = 4096;
}
+
+ portno = htons(g_last_tcp_port);
Review comment:
Hi @antmerlino ,
Thanks for review, I update the change and unifies the byte orders to
network, please review again
--
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]