]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
selection: try to resolve NS addr instead of choosing the same server
authorŠtěpán Balážik <stepan.balazik@nic.cz>
Thu, 10 Sep 2020 11:39:24 +0000 (13:39 +0200)
committerŠtěpán Balážik <stepan.balazik@nic.cz>
Thu, 15 Oct 2020 11:22:22 +0000 (13:22 +0200)
lib/selection.c

index 8fe967e4b90ba7c3764e51b6eadc869d26dca350..08abb01f79408d8535e280d6bcdc02b0bcfdc6ae 100644 (file)
@@ -224,6 +224,16 @@ struct kr_transport *choose_transport(struct choice choices[],
                choice = 0;
        }
 
+
+       // Don't try the same server again when there are other choices to be explored
+       if (choices[choice].address_state->errors && unresolved_len) {
+               *transport = (struct kr_transport) {
+                       .protocol = KR_TRANSPORT_NOADDR,
+                       .name = unresolved[kr_rand_bytes(1) % unresolved_len]
+               };
+               return transport;
+       }
+
        unsigned timeout = calc_timeout(choices[choice].address_state->rtt_state);
        if (no_rtt_info(choices[choice].address_state->rtt_state)) {
                // Exponential back-off when retrying after timeout and choosing an unknown server