diff options
author | 2002-01-15 16:59:08 +0000 | |
---|---|---|
committer | 2002-01-15 16:59:08 +0000 | |
commit | f8de1e70137fe06a4e59caf8a1dc3eb30c208d4f (patch) | |
tree | e7b99079d57177747ae0e8b9a35a34bf9cee171a | |
parent | update to sudo 1.6.4p1 (diff) | |
download | wireguard-openbsd-f8de1e70137fe06a4e59caf8a1dc3eb30c208d4f.tar.xz wireguard-openbsd-f8de1e70137fe06a4e59caf8a1dc3eb30c208d4f.zip |
change tcpcb allocation to pool
-rw-r--r-- | sys/netinet/tcp_subr.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index d3a5aeeacbd..e70f4406909 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.53 2002/01/14 03:11:55 provos Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.54 2002/01/15 16:59:08 provos Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -143,6 +143,8 @@ int tcbhashsize = TCBHASHSIZE; extern int ip6_defhlim; #endif /* INET6 */ +struct pool tcpcb_pool; + struct tcpstat tcpstat; /* tcp statistics */ /* @@ -154,6 +156,8 @@ tcp_init() #ifdef TCP_COMPAT_42 tcp_iss = 1; /* wrong */ #endif /* TCP_COMPAT_42 */ + pool_init(&tcpcb_pool, sizeof(struct tcpcb), 0, 0, 0, "tcpcbpl", + 0, NULL, NULL, M_PCB); in_pcbinit(&tcbtable, tcbhashsize); tcp_now = arc4random() / 2; @@ -451,7 +455,7 @@ tcp_newtcpcb(struct inpcb *inp) struct tcpcb *tp; int i; - tp = malloc(sizeof(*tp), M_PCB, M_NOWAIT); + tp = pool_get(&tcpcb_pool, PR_NOWAIT); if (tp == NULL) return ((struct tcpcb *)0); bzero((char *) tp, sizeof(struct tcpcb)); @@ -682,7 +686,7 @@ tcp_close(tp) #endif if (tp->t_template) (void) m_free(tp->t_template); - free(tp, M_PCB); + pool_put(&tcpcb_pool, tp); inp->inp_ppcb = 0; soisdisconnected(so); in_pcbdetach(inp); |