diff options
author | yar <yar@FreeBSD.org> | 2004-11-22 11:10:04 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2004-11-22 11:10:04 +0000 |
commit | a4b5efda6e57a55e7ddf0b7a0f2790d8db4dccb4 (patch) | |
tree | 77f96edfe15e3ce115171109f1b4871fe17e679b /libexec | |
parent | c859d4601134c6824837a0577c022679e4a07a39 (diff) | |
download | FreeBSD-src-a4b5efda6e57a55e7ddf0b7a0f2790d8db4dccb4.zip FreeBSD-src-a4b5efda6e57a55e7ddf0b7a0f2790d8db4dccb4.tar.gz |
When looking for a virtual host to handle the connection,
stop the search on the first match for efficiency.
Submitted by: Nick Leuta
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ftpd/ftpd.c | 5 |
1 files changed, 3 insertions, 2 deletions
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; |