Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
42fe4941
Commit
42fe4941
authored
Nov 19, 1999
by
Michael Graff
Browse files
Minor API change. The 'factor' now ranges from 0..10. See adb.h for details.
parent
5012c7b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/dns/adb.c
View file @
42fe4941
...
...
@@ -3401,14 +3401,14 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
REQUIRE
(
DNS_ADB_VALID
(
adb
));
REQUIRE
(
DNS_ADBADDRINFO_VALID
(
addr
));
if
(
factor
==
0
)
factor
=
4
;
REQUIRE
(
factor
<=
10
);
bucket
=
addr
->
entry
->
lock_bucket
;
LOCK
(
&
adb
->
entrylocks
[
bucket
]);
new_srtt
=
(
addr
->
entry
->
srtt
*
(
factor
-
1
)
+
rtt
)
/
factor
;
new_srtt
=
(
addr
->
entry
->
srtt
/
10
*
factor
)
+
(
rtt
/
10
*
(
10
-
factor
));
addr
->
entry
->
srtt
=
new_srtt
;
addr
->
srtt
=
new_srtt
;
...
...
lib/dns/include/dns/adb.h
View file @
42fe4941
...
...
@@ -445,6 +445,12 @@ dns_adb_adjustgoodness(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
* goodness value. This may include changes made by others.
*/
/*
* A reasonable default for RTT adjustments
*/
#define DNS_ADB_RTTADJDEFAULT 7
/* default scale */
#define DNS_ADB_RTTADJREPLACE 0
/* replace with our rtt */
void
dns_adb_adjustsrtt
(
dns_adb_t
*
adb
,
dns_adbaddrinfo_t
*
addr
,
unsigned
int
rtt
,
unsigned
int
factor
);
...
...
@@ -453,7 +459,7 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
* (where srtt is the existing rtt value, and rtt and factor are arguments to
* this function):
*
* new_srtt = (srtt *
(
factor
- 1
) + rtt
)
/ factor
* new_srtt = (
old_
srtt
/ 10
* factor) +
(
rtt /
10 * (10 -
factor
));
*
* Requires:
*
...
...
@@ -461,9 +467,9 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
*
* addr be valid.
*
*
Note:
*
0 <= factor <= 10
*
*
If factor is zero, 4 will be used.
*
Note:
*
* The srtt in addr will be updated to reflect the new global
* srtt value. This may include changes made by others.
...
...
lib/dns/resolver.c
View file @
42fe4941
...
...
@@ -269,7 +269,7 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp,
if
(
finish
!=
NULL
)
{
rtt
=
(
unsigned
int
)
isc_time_microdiff
(
finish
,
&
query
->
start
);
factor
=
0
;
factor
=
DNS_ADB_RTTADJDEFAULT
;
}
else
{
/*
* We don't have an RTT for this query. Maybe the packet
...
...
@@ -280,10 +280,9 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp,
if
(
rtt
>
10000000
)
rtt
=
10000000
;
/*
* We set 'factor' to 1, so that we will replace the current
* RTT.
* Replace the current RTT with our value.
*/
factor
=
1
;
factor
=
DNS_ADB_RTTADJREPLACE
;
}
dns_adb_adjustsrtt
(
fctx
->
res
->
view
->
adb
,
query
->
addrinfo
,
rtt
,
factor
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment