From owner-svn-src-head@FreeBSD.ORG Sun Oct 28 19:58:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 78E33B7E; Sun, 28 Oct 2012 19:58:21 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60A718FC08; Sun, 28 Oct 2012 19:58:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9SJwLTM087788; Sun, 28 Oct 2012 19:58:21 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9SJwLV3087786; Sun, 28 Oct 2012 19:58:21 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201210281958.q9SJwLV3087786@svn.freebsd.org> From: Andre Oppermann Date: Sun, 28 Oct 2012 19:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r242267 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2012 19:58:21 -0000 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);