Configuring TCP Time-Wait Vector Management
The TCP peer that closes the connection first has to wait for 2MSL (60 seconds by default) before freeing the TCP vector. If the user opens and closes TCP connections rapidly, a lot of TCP vectors stay allocated in the TIME-WAIT state. In versions of Treck that preceeded 6.0, the allocated TCP vectors in TIME-WAIT state would have prevented the user from opening new sockets when the maximum number of allowed TCP vectors/sockets had been reached. These vectors were also consuming a significant amount of memory. To rectify these situations the behavior was changed so that the TCP vector is closed and freed when the TCP vector reaches the TIME-WAIT state, and a new (smaller) TCP Time-Wait vector is allocated to take its place. Treck manages the number of TCP Time-Wait vectors allocated.
Configuring the Maximum Number of TCP Time-Wait Vectors
To change the default maximum number of TCP Time-Wait vectors at compile time, redefine the TM_TCPTMWT_MAX_COUNT in <trsystem.h>. The default is TM_TCPVECT_MAX_COUNT * 8.
To change the default maximum number of TCP time wait vectors at run time, call tfSetTreckOptions() with the TM_OPTION_TCP_TMWT_MAX option name.
Configuring the TCP Time-Wait Vector Hash Table
The TCP Time-Wait Vectors are kept in a hash lookup table. When an incoming packet is received, first the TCP socket table is looked up. If the lookup yields a TCP listening vector, or no socket, then the stack looks up the Time-Wait Vector table for a (better) match. The stack also looks up the Time-Wait Vector table to try and re-use its sequence number for a new connection ISS.
To change the Time-Wait Vector Hash Table size at run time, call tfSetTreckOptions() with the option name TM_OPTION_TIME_WAIT_HASH_SIZE.