diff options
author | mohans <mohans@FreeBSD.org> | 2007-02-26 22:25:21 +0000 |
---|---|---|
committer | mohans <mohans@FreeBSD.org> | 2007-02-26 22:25:21 +0000 |
commit | 384aeb29f6100b5e13581c56efdea6d423675769 (patch) | |
tree | 21cfa3a2368a7f712458dfdd8d3485b03c0c6fa7 /sys/netinet/tcp_usrreq.c | |
parent | 2bd7382fdc16aa04088cebb691546535c56c484b (diff) | |
download | FreeBSD-src-384aeb29f6100b5e13581c56efdea6d423675769.zip FreeBSD-src-384aeb29f6100b5e13581c56efdea6d423675769.tar.gz |
Reap FIN_WAIT_2 connections marked SOCANTRCVMORE faster. This mitigate
potential issues where the peer does not close, potentially leaving
thousands of connections in FIN_WAIT_2. This is controlled by a new sysctl
fast_finwait2_recycle, which is disabled by default.
Reviewed by: gnn, silby.
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index c4362cf..57195a4 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1581,9 +1581,14 @@ tcp_usrclosed(tp) if (tp && tp->t_state >= TCPS_FIN_WAIT_2) { soisdisconnected(tp->t_inpcb->inp_socket); /* To prevent the connection hanging in FIN_WAIT_2 forever. */ - if (tp->t_state == TCPS_FIN_WAIT_2) - callout_reset(tp->tt_2msl, tcp_maxidle, + if (tp->t_state == TCPS_FIN_WAIT_2) { + int timeout; + + timeout = (tcp_fast_finwait2_recycle) ? + tcp_finwait2_timeout : tcp_maxidle; + callout_reset(tp->tt_2msl, timeout, tcp_timer_2msl, tp); + } } } |