From d28b9e89a9cbb9f62dc842ba71595ea8bd30788b Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 4 Feb 2011 14:13:15 +0000 Subject: [PATCH] When turning off TCP_NOPUSH, only call tcp_output() to immediately flush any pending data if the connection is established. Submitted by: csjp Reviewed by: lstewart MFC after: 1 week --- 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 b2fce82d629..6acf9dad83c 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1328,9 +1328,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;