summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_timewait.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-02-14 18:15:53 +0000
committerwollman <wollman@FreeBSD.org>1997-02-14 18:15:53 +0000
commit731964886006c63acb149497e458d29a68368332 (patch)
tree41d6953fc4c7a2929081f52e766fbc604285351b /sys/netinet/tcp_timewait.c
parent936314fb4096f9ce1eb390ac682800ecdb6cdc5a (diff)
downloadFreeBSD-src-731964886006c63acb149497e458d29a68368332.zip
FreeBSD-src-731964886006c63acb149497e458d29a68368332.tar.gz
Fix the mechanism for choosing wehether to save the slow-start threshold
in the route. This allows us to remove the unconditional setting of the pipesize in the route, which should mean that SO_SNDBUF and SO_RCVBUF should actually work again. While we're at it: - Convert udp_usrreq from `mondo switch statement from Hell' to new-style. - Delete old TCP mondo switch statement from Hell, which had previously been diked out.
Diffstat (limited to 'sys/netinet/tcp_timewait.c')
-rw-r--r--sys/netinet/tcp_timewait.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index cfa21d7..2f71ca2 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -320,6 +320,7 @@ tcp_close(tp)
struct socket *so = inp->inp_socket;
register struct mbuf *m;
register struct rtentry *rt;
+ int dosavessthresh;
/*
* If we got enough samples through the srtt filter,
@@ -364,15 +365,31 @@ tcp_close(tp)
tcpstat.tcps_cachedrttvar++;
}
/*
+ * The old comment here said:
* update the pipelimit (ssthresh) if it has been updated
* already or if a pipesize was specified & the threshhold
* got below half the pipesize. I.e., wait for bad news
* before we start updating, then update on both good
* and bad news.
+ *
+ * But we want to save the ssthresh even if no pipesize is
+ * specified explicitly in the route, because such
+ * connections still have an implicit pipesize specified
+ * by the global tcp_sendspace. In the absence of a reliable
+ * way to calculate the pipesize, it will have to do.
*/
+ i = tp->snd_ssthresh;
+#if 1
+ if (rt->rt_rmx.rmx_sendpipe != 0)
+ dosavessthresh = (i < rt->rt_rmx.rmx_sendpipe / 2);
+ else
+ dosavessthresh = (i < so->so_snd.sb_hiwat / 2);
+#else
+ dosavessthresh = (i < rt->rt_rmx.rmx_sendpipe / 2);
+#endif
if (((rt->rt_rmx.rmx_locks & RTV_SSTHRESH) == 0 &&
- ((i = tp->snd_ssthresh) != 0) && rt->rt_rmx.rmx_ssthresh) ||
- i < (rt->rt_rmx.rmx_sendpipe / 2)) {
+ i != 0 && rt->rt_rmx.rmx_ssthresh != 0)
+ || dosavessthresh) {
/*
* convert the limit from user data bytes to
* packets then to packet data bytes.
OpenPOWER on IntegriCloud