From 6da017d0ce67919c7b86efd0755bd888e39f47d8 Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 11 Feb 2011 15:14:51 +0000 Subject: [PATCH] MFC 218271: When turning off TCP_NOPUSH, only call tcp_output() to immediately flush any pending data if the connection is established. Approved by: re (kib) git-svn-id: svn://svn.freebsd.org/base/releng/8.2@218575 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/netinet/tcp_usrreq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 6ed592e1..b8d544a2 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1331,9 +1331,10 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) INP_WLOCK_RECHECK(inp); if (optval) tp->t_flags |= TF_NOPUSH; - else { + else if (tp->t_flags & TF_NOPUSH) { tp->t_flags &= ~TF_NOPUSH; - error = tcp_output(tp); + if (TCPS_HAVEESTABLISHED(tp->t_state)) + error = tcp_output(tp); } INP_WUNLOCK(inp); break; -- 2.42.0