mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-25 02:42:33 -05:00
developer: marka
reviewed: jinmei 1364. [func] Use response times to select forwarders.
This commit is contained in:
parent
08f31107e2
commit
39fe146f2a
2 changed files with 27 additions and 13 deletions
2
CHANGES
2
CHANGES
|
|
@ -1,3 +1,5 @@
|
|||
1364. [func] Use response times to select forwarders.
|
||||
|
||||
1363. [contrib] queryperf usage was incomplete. Add '-h' for help.
|
||||
|
||||
1362. [func] "localhost" and "localnet" acls now include IPv6
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: resolver.c,v 1.246 2002/08/09 06:12:50 marka Exp $ */
|
||||
/* $Id: resolver.c,v 1.247 2002/08/23 00:27:10 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -210,6 +210,7 @@ struct fetchctx {
|
|||
#define FCTX_ATTR_WANTCACHE 0x10
|
||||
#define FCTX_ATTR_WANTNCACHE 0x20
|
||||
#define FCTX_ATTR_NEEDEDNS0 0x40
|
||||
#define FCTX_ATTR_TRIEDFIND 0x80
|
||||
|
||||
#define HAVE_ANSWER(f) (((f)->attributes & FCTX_ATTR_HAVEANSWER) != \
|
||||
0)
|
||||
|
|
@ -222,6 +223,7 @@ struct fetchctx {
|
|||
#define WANTCACHE(f) (((f)->attributes & FCTX_ATTR_WANTCACHE) != 0)
|
||||
#define WANTNCACHE(f) (((f)->attributes & FCTX_ATTR_WANTNCACHE) != 0)
|
||||
#define NEEDEDNS0(f) (((f)->attributes & FCTX_ATTR_NEEDEDNS0) != 0)
|
||||
#define TRIEDFIND(f) (((f)->attributes & FCTX_ATTR_TRIEDFIND) != 0)
|
||||
|
||||
struct dns_fetch {
|
||||
unsigned int magic;
|
||||
|
|
@ -371,6 +373,8 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp,
|
|||
resquery_t *query;
|
||||
unsigned int rtt;
|
||||
unsigned int factor;
|
||||
dns_adbfind_t *find;
|
||||
dns_adbaddrinfo_t *addrinfo;
|
||||
|
||||
query = *queryp;
|
||||
fctx = query->fctx;
|
||||
|
|
@ -415,11 +419,15 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp,
|
|||
/*
|
||||
* Age RTTs of servers not tried.
|
||||
*/
|
||||
if (finish != NULL) {
|
||||
dns_adbfind_t *find;
|
||||
dns_adbaddrinfo_t *addrinfo;
|
||||
|
||||
factor = DNS_ADB_RTTADJAGE;
|
||||
factor = DNS_ADB_RTTADJAGE;
|
||||
if (finish != NULL)
|
||||
for (addrinfo = ISC_LIST_HEAD(fctx->forwaddrs);
|
||||
addrinfo != NULL;
|
||||
addrinfo = ISC_LIST_NEXT(addrinfo, publink))
|
||||
if (UNMARKED(addrinfo))
|
||||
dns_adb_adjustsrtt(fctx->adb, addrinfo,
|
||||
0, factor);
|
||||
if (finish != NULL && !TRIEDFIND(fctx))
|
||||
for (find = ISC_LIST_HEAD(fctx->finds);
|
||||
find != NULL;
|
||||
find = ISC_LIST_NEXT(find, publink))
|
||||
|
|
@ -429,7 +437,6 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp,
|
|||
if (UNMARKED(addrinfo))
|
||||
dns_adb_adjustsrtt(fctx->adb, addrinfo,
|
||||
0, factor);
|
||||
}
|
||||
|
||||
if (query->dispentry != NULL)
|
||||
dns_dispatch_removeresponse(&query->dispentry, deventp);
|
||||
|
|
@ -1481,8 +1488,16 @@ fctx_getaddresses(fetchctx_t *fctx) {
|
|||
result = dns_adb_findaddrinfo(fctx->adb,
|
||||
sa, &ai, 0); /* XXXMLG */
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
dns_adbaddrinfo_t *cur;
|
||||
ai->flags |= FCTX_ADDRINFO_FORWARDER;
|
||||
ISC_LIST_APPEND(fctx->forwaddrs, ai, publink);
|
||||
cur = ISC_LIST_HEAD(fctx->forwaddrs);
|
||||
while (cur != NULL && cur->srtt < ai->srtt)
|
||||
cur = ISC_LIST_NEXT(cur, publink);
|
||||
if (cur != NULL)
|
||||
ISC_LIST_INSERTBEFORE(fctx->forwaddrs, cur,
|
||||
ai, publink);
|
||||
else
|
||||
ISC_LIST_APPEND(fctx->forwaddrs, ai, publink);
|
||||
}
|
||||
sa = ISC_LIST_NEXT(sa, link);
|
||||
}
|
||||
|
|
@ -1656,11 +1671,6 @@ fctx_getaddresses(fetchctx_t *fctx) {
|
|||
* We've found some addresses. We might still be looking
|
||||
* for more addresses.
|
||||
*/
|
||||
/*
|
||||
* XXXRTH We could sort the forwaddrs here if the caller
|
||||
* wants to use the forwaddrs in "best order" as
|
||||
* opposed to "fixed order".
|
||||
*/
|
||||
sort_finds(fctx);
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
|
|
@ -1752,6 +1762,8 @@ fctx_nextaddress(fetchctx_t *fctx) {
|
|||
}
|
||||
}
|
||||
|
||||
fctx->attributes |= FCTX_ATTR_TRIEDFIND;
|
||||
|
||||
/*
|
||||
* No forwarders. Move to the next find.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue