svn commit: r232460 - user/andre/tcp_workqueue/sys/netinet
Andre Oppermann
andre at FreeBSD.org
Sat Mar 3 13:31:21 UTC 2012
Author: andre
Date: Sat Mar 3 13:31:20 2012
New Revision: 232460
URL: http://svn.freebsd.org/changeset/base/232460
Log:
If the user has closed the socket then drop a persisting connection
after a much reduced timeout.
Typically web servers close their sockets quickly under the assumption
that the TCP connections goes away as well. That is not entirely true
however. If the peer closed the window we're going to wait for a long
time with lots of data in the send buffer.
Modified:
user/andre/tcp_workqueue/sys/netinet/tcp_timer.c
Modified: user/andre/tcp_workqueue/sys/netinet/tcp_timer.c
==============================================================================
--- user/andre/tcp_workqueue/sys/netinet/tcp_timer.c Sat Mar 3 13:02:28 2012 (r232459)
+++ user/andre/tcp_workqueue/sys/netinet/tcp_timer.c Sat Mar 3 13:31:20 2012 (r232460)
@@ -424,6 +424,16 @@ tcp_timer_persist(void *xtp)
tp = tcp_drop(tp, ETIMEDOUT);
goto out;
}
+ /*
+ * If the user has closed the socket then drop a persisting
+ * connection after a much reduced timeout.
+ */
+ if (tp->t_state > TCPS_CLOSE_WAIT &&
+ (ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) {
+ TCPSTAT_INC(tcps_persistdrop);
+ tp = tcp_drop(tp, ETIMEDOUT);
+ goto out;
+ }
tcp_setpersist(tp);
tp->t_flags |= TF_FORCEDATA;
(void) tcp_output(tp);
More information about the svn-src-user
mailing list