When looking for a virtual host to handle the connection,

stop the search on the first match for efficiency.

Submitted by:	Nick Leuta
This commit is contained in:
Yaroslav Tykhiy 2004-11-22 11:10:04 +00:00
parent 4cbc4ad644
commit ebd83647a4

@ -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;