From a4b5efda6e57a55e7ddf0b7a0f2790d8db4dccb4 Mon Sep 17 00:00:00 2001 From: yar Date: Mon, 22 Nov 2004 11:10:04 +0000 Subject: When looking for a virtual host to handle the connection, stop the search on the first match for efficiency. Submitted by: Nick Leuta --- libexec/ftpd/ftpd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libexec/ftpd/ftpd.c') diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 9f575bf..87aeb74 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -866,7 +866,7 @@ selecthost(union sockunion *su) for (hi = hrp->hostinfo; hi != NULL; hi = hi->ai_next) { if (memcmp(su, hi->ai_addr, hi->ai_addrlen) == 0) { thishost = hrp; - break; + goto found; } #ifdef INET6 /* XXX IPv4 mapped IPv6 addr consideraton */ @@ -875,12 +875,13 @@ selecthost(union sockunion *su) &((struct sockaddr_in *)hi->ai_addr)->sin_addr, sizeof(struct in_addr)) == 0)) { thishost = hrp; - break; + goto found; } #endif } hrp = hrp->next; } +found: su->su_port = port; /* setup static variables as appropriate */ hostname = thishost->hostname; -- cgit v1.1