From f41767543e91978acb89276274f32fe6566ef613 Mon Sep 17 00:00:00 2001 From: silby Date: Sat, 23 Jun 2001 03:21:46 +0000 Subject: Eliminate the allocation of a tcp template structure for each connection. The information contained in a tcptemp can be reconstructed from a tcpcb when needed. Previously, tcp templates required the allocation of one mbuf per connection. On large systems, this change should free up a large number of mbufs. Reviewed by: bmilekic, jlemon, ru MFC after: 2 weeks --- sys/netinet/tcp_timer.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sys/netinet/tcp_timer.c') diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index a035989..488c293 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -222,6 +223,7 @@ tcp_timer_keep(xtp) void *xtp; { struct tcpcb *tp = xtp; + struct tcptemp *t_template; int s; #ifdef TCPDEBUG int ostate; @@ -259,9 +261,13 @@ tcp_timer_keep(xtp) * correspondent TCP to respond. */ tcpstat.tcps_keepprobe++; - tcp_respond(tp, tp->t_template->tt_ipgen, - &tp->t_template->tt_t, (struct mbuf *)NULL, - tp->rcv_nxt, tp->snd_una - 1, 0); + t_template = tcp_maketemplate(tp); + if (t_template) { + tcp_respond(tp, t_template->tt_ipgen, + &t_template->tt_t, (struct mbuf *)NULL, + tp->rcv_nxt, tp->snd_una - 1, 0); + (void) m_free(dtom(t_template)); + } callout_reset(tp->tt_keep, tcp_keepintvl, tcp_timer_keep, tp); } else callout_reset(tp->tt_keep, tcp_keepidle, tcp_timer_keep, tp); -- cgit v1.1