mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 09:56:51 +03:00
resolved: Recover from slow DNS responses
When DNS is unreliable temporarily, the current implementation will never improve resend behavior again and switch DNS servers only late (current maximum timeout is 5 seconds). We can improve this by biasing the resend_timeout back to the current RTT when a successful response was received. Next time, a timeout is hit on this server, it will switch to the next server faster. Fixes: #5953
This commit is contained in:
parent
9af868392b
commit
496ae8c84b
@ -304,7 +304,10 @@ void dns_server_packet_received(DnsServer *s, int protocol, DnsServerFeatureLeve
|
||||
if (s->max_rtt < rtt) {
|
||||
s->max_rtt = rtt;
|
||||
s->resend_timeout = CLAMP(s->max_rtt * 2, DNS_TIMEOUT_MIN_USEC, DNS_TIMEOUT_MAX_USEC);
|
||||
}
|
||||
} else if (s->resend_timeout > rtt)
|
||||
/* If we received the packet faster than the resend_timeout, bias
|
||||
* the resend_timeout back to the rtt. */
|
||||
s->resend_timeout = CLAMP((2 * s->resend_timeout + rtt) / 3, DNS_TIMEOUT_MIN_USEC, DNS_TIMEOUT_MAX_USEC);
|
||||
}
|
||||
|
||||
void dns_server_packet_lost(DnsServer *s, int protocol, DnsServerFeatureLevel level, usec_t usec) {
|
||||
|
Loading…
Reference in New Issue
Block a user