diff options
author | dg <dg@FreeBSD.org> | 1995-03-02 19:29:42 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-03-02 19:29:42 +0000 |
commit | 2fed68467b1df9201d3e4aaed8cb39bd4b70be02 (patch) | |
tree | c7eef76dc7da664d613b4e06c0f72130b1aac347 /sys/netinet/in_pcb.c | |
parent | 45316e458f0223cbcb4861ff688ab6a568ffe100 (diff) | |
download | FreeBSD-src-2fed68467b1df9201d3e4aaed8cb39bd4b70be02.zip FreeBSD-src-2fed68467b1df9201d3e4aaed8cb39bd4b70be02.tar.gz |
Move exact match pcb's to the head of the list to improve lookup
performance.
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 3f6343b..e02be15 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 - * $Id: in_pcb.c,v 1.4 1995/02/08 20:22:07 wollman Exp $ + * $Id: in_pcb.c,v 1.5 1995/02/16 00:55:37 wollman Exp $ */ #include <sys/param.h> @@ -495,7 +495,7 @@ in_pcblookup(head, faddr, fport_arg, laddr, lport_arg, flags) u_int fport_arg, lport_arg; int flags; { - register struct inpcb *inp, *match = 0; + register struct inpcb *inp, *match = NULL; int matchwild = 3, wildcard; u_short fport = fport_arg, lport = lport_arg; @@ -527,8 +527,13 @@ in_pcblookup(head, faddr, fport_arg, laddr, lport_arg, flags) if (wildcard < matchwild) { match = inp; matchwild = wildcard; - if (matchwild == 0) + if (matchwild == 0) { + if (match->inp_prev != head) { + remque(match); + insque(match, head); + } break; + } } } return (match); |