diff options
author | Štěpán Balážik <stepan.balazik@nic.cz> | 2021-03-17 15:53:33 +0100 |
---|---|---|
committer | Tomas Krizek <tomas.krizek@nic.cz> | 2021-03-19 13:25:10 +0100 |
commit | 7bd70e162d44cae62a8b1ac2b09e5b5790ceab8e (patch) | |
tree | 3c0d0a124aa2946757eb13ab58d08c9c4356e6ab /lib/selection.h | |
parent | Merge !1150: selection_iter.c: fix the last stand switch to UDP (diff) | |
download | knot-resolver-7bd70e162d44cae62a8b1ac2b09e5b5790ceab8e.tar.xz knot-resolver-7bd70e162d44cae62a8b1ac2b09e5b5790ceab8e.zip |
selection: cap the timeout value when probing a random server
This patch caps the timeout set on UDP queries to servers chosen in the
EXPLORE phase of the selection algorithm to two times the timeout that
would be set if we were EXPLOITing.
This measns that we no longer spend an unreasonable amount of time
probing servers that are probably dead anyway while ensuring that we do
probe them from time to time to check if they didn't come to life.
If the timeout value is capped and the server fails to respond, we don't
punish the server for it i.e. we don't cache the timeout.
Diffstat (limited to 'lib/selection.h')
-rw-r--r-- | lib/selection.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/selection.h b/lib/selection.h index 5b7bf15f..ca98fa6b 100644 --- a/lib/selection.h +++ b/lib/selection.h @@ -70,6 +70,12 @@ struct kr_transport { size_t address_len; enum kr_transport_protocol protocol; unsigned timeout; /**< Timeout in ms to be set for UDP transmission. */ + /** Timeout was capped to a maximum value based on the other candidates + * when choosing this transport. The timeout therefore can be much lower + * than what we expect it to be. We basically probe the server for a sudden + * network change but we expect it to timeout in most cases. We have to keep + * this in mind when noting the timeout in cache. */ + bool timeout_capped; /** True iff transport was set in worker.c:subreq_finalize, * that means it may be different from the one originally chosen one.*/ bool deduplicated; |