+
+ if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
+ /*
+ * The goal is to let clients have large send/rcv default windows (TCP_INCREASED_SPACE)
+ * while not hogging mbuf space for servers. This is done by watching a threshold
+ * of tcpcbs in use and bumping the default send and rcvspace only if under that threshold.
+ * The theory being that busy servers have a lot more active tcpcbs and don't want the potential
+ * memory penalty of having much larger sockbuffs. The sysctl allows to fine tune that threshold value. */
+
+ if (inp->inp_pcbinfo->ipi_count < tcp_sockthreshold)
+ error = soreserve(so, MAX(TCP_INCREASED_SPACE, tcp_sendspace), MAX(TCP_INCREASED_SPACE,tcp_recvspace));
+ else
+ error = soreserve(so, tcp_sendspace, tcp_recvspace);
+ if (error)
+ return (error);
+ }
+