Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Oct 2012 19:58:21 +0000 (UTC)
From:      Andre Oppermann <andre@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r242267 - head/sys/netinet
Message-ID:  <201210281958.q9SJwLV3087786@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andre
Date: Sun Oct 28 19:58:20 2012
New Revision: 242267
URL: http://svn.freebsd.org/changeset/base/242267

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.
  
  MFC after:	2 weeks

Modified:
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_timer.c
==============================================================================
--- head/sys/netinet/tcp_timer.c	Sun Oct 28 19:47:46 2012	(r242266)
+++ head/sys/netinet/tcp_timer.c	Sun Oct 28 19:58:20 2012	(r242267)
@@ -447,6 +447,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210281958.q9SJwLV3087786>