net/tcp: Be consistent with units of TIME_WAIT. Units were unspecified in tcp/Kconfig, but assumed to be in units of half seconds in tcp/timer.h. include/nuttx/netconfig does not indicate the units but is apparently assuming seconds. This commit unifies all delays to clearly specified units of seconds.
This commit is contained in:
parent
1a56fefb9f
commit
9efadaefc1
|
@ -533,7 +533,17 @@
|
|||
# define MIN_TCP_MSS __MIN_TCP_MSS(__IPv6_HDRLEN)
|
||||
#endif
|
||||
|
||||
/* How long a connection should stay in the TIME_WAIT state. */
|
||||
/* How long a connection should stay in the TIME_WAIT state.
|
||||
*
|
||||
* TIME_WAIT is often also known as the 2MSL wait state. This is because
|
||||
* the socket that transitions to TIME_WAIT stays there for a period that
|
||||
* is 2 x Maximum Segment Lifetime in duration. The MSL is the maximum
|
||||
* amount of time that any segment can remain valid on the network before
|
||||
* being discarded. This time limit is ultimately bounded by the TTL field
|
||||
* in the IP datagram that is used to transmit the TCP segment. RFC 793
|
||||
* specifies MSL as 2 minutes but most systems permit this value to be tuned.
|
||||
* Here a default of 2 minutes is used, half the value specified by RFC 793.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_TCP_WAIT_TIMEOUT
|
||||
# define TCP_TIME_WAIT_TIMEOUT CONFIG_NET_TCP_WAIT_TIMEOUT
|
||||
|
|
|
@ -51,7 +51,8 @@ config NET_TCP_WAIT_TIMEOUT
|
|||
int "TIME_WAIT Length of TCP/IP connections"
|
||||
default 120
|
||||
---help---
|
||||
TIME_WAIT Length of TCP/IP connections (all tasks)
|
||||
TIME_WAIT Length of TCP/IP connections (all tasks). In units
|
||||
of seconds.
|
||||
|
||||
config NET_MAX_LISTENPORTS
|
||||
int "Number of listening ports"
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
* Input Parameters:
|
||||
* dev - The device driver structure to use in the send operation
|
||||
* conn - The TCP "connection" to poll for TX data
|
||||
* hsed - The polling interval in halves of a second
|
||||
* hsec - The polling interval in units of halves of a second
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
|
@ -143,11 +143,11 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||
|
||||
/* Check if the timer exceeds the timeout value */
|
||||
|
||||
if (newtimer >= TCP_TIME_WAIT_TIMEOUT)
|
||||
if (newtimer >= (TCP_TIME_WAIT_TIMEOUT * HSEC_PER_SEC))
|
||||
{
|
||||
/* Set the timer to the maximum value */
|
||||
|
||||
conn->timer = TCP_TIME_WAIT_TIMEOUT;
|
||||
conn->timer = TCP_TIME_WAIT_TIMEOUT * HSEC_PER_SEC;
|
||||
|
||||
/* The TCP connection was established and, hence, should be bound
|
||||
* to a device. Make sure that the polling device is the one that
|
||||
|
|
Loading…
Reference in New Issue