mirror of https://github.com/getdnsapi/getdns.git
Syntactic mod to minimizing changes with before PR
So changes are highlighted in side-by-side views.
This commit is contained in:
parent
7af885396f
commit
bf1f01c87e
79
src/stub.c
79
src/stub.c
|
@ -2082,52 +2082,49 @@ upstream_select_stateful(getdns_network_req *netreq, getdns_transport_list_t tra
|
||||||
if (i >= upstreams->count)
|
if (i >= upstreams->count)
|
||||||
i = 0;
|
i = 0;
|
||||||
} while (i != upstreams->current_stateful);
|
} while (i != upstreams->current_stateful);
|
||||||
|
|
||||||
if (!upstream) {
|
if (!upstream) {
|
||||||
/* Oh, oh. We have no valid upstreams for this transport. */
|
/* Oh, oh. We have no valid upstreams for this transport. */
|
||||||
/* If there are other fallback transports that are working, we should
|
/* If there are other fallback transports that are working, we should
|
||||||
use them before forcilby promoting failed upstreams for re-try, since
|
use them before forcibly promoting failed upstreams for re-try, since
|
||||||
waiting for the the re-try timer to re-instate them is the right thing
|
waiting for the the re-try timer to re-instate them is the right thing
|
||||||
in this case. */
|
in this case. */
|
||||||
if (other_transports_working(netreq, upstreams, transport)) {
|
if (other_transports_working(netreq, upstreams, transport))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* Try to find one that might work so
|
||||||
|
allow backed off upstreams to be considered valid.
|
||||||
|
Don't worry about the policy, just use the one with the least bad
|
||||||
|
stats that still fits the bill (right transport, right authentication)
|
||||||
|
to try to avoid total failure due to network outages. */
|
||||||
|
do {
|
||||||
|
if (upstream_valid(&upstreams->upstreams[i], transport, netreq, 1)) {
|
||||||
|
upstream = &upstreams->upstreams[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
if (i >= upstreams->count)
|
||||||
|
i = 0;
|
||||||
|
} while (i != upstreams->current_stateful);
|
||||||
|
if (!upstream) {
|
||||||
|
/* We _really_ have nothing that authenticates well enough right now...
|
||||||
|
leave to regular backoff logic. */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
do {
|
||||||
/* Try to find one that might work so
|
i++;
|
||||||
allow backed off upstreams to be considered valid.
|
if (i >= upstreams->count)
|
||||||
Don't worry about the policy, just use the one with the least bad
|
i = 0;
|
||||||
stats that still fits the bill (right transport, right authentication)
|
if (upstream_valid(&upstreams->upstreams[i], transport, netreq, 1) &&
|
||||||
to try to avoid total failure due to network outages. */
|
upstream_stats(&upstreams->upstreams[i]) > upstream_stats(upstream))
|
||||||
do {
|
upstream = &upstreams->upstreams[i];
|
||||||
if (upstream_valid(&upstreams->upstreams[i], transport, netreq, 1)) {
|
} while (i != upstreams->current_stateful);
|
||||||
upstream = &upstreams->upstreams[i];
|
upstream->conn_state = GETDNS_CONN_CLOSED;
|
||||||
break;
|
upstream->conn_backoff_interval = 1;
|
||||||
}
|
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_NOTICE,
|
||||||
i++;
|
"%-40s : Upstream : No valid upstreams for %s... promoting this backed-off upstream for re-try...\n",
|
||||||
if (i >= upstreams->count)
|
upstream->addr_str,
|
||||||
i = 0;
|
upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP");
|
||||||
} while (i != upstreams->current_stateful);
|
return upstream;
|
||||||
if (!upstream) {
|
|
||||||
/* We _really_ have nothing that authenticates well enough right now...
|
|
||||||
leave to regular backoff logic. */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
i++;
|
|
||||||
if (i >= upstreams->count)
|
|
||||||
i = 0;
|
|
||||||
if (upstream_valid(&upstreams->upstreams[i], transport, netreq, 1) &&
|
|
||||||
upstream_stats(&upstreams->upstreams[i]) > upstream_stats(upstream))
|
|
||||||
upstream = &upstreams->upstreams[i];
|
|
||||||
} while (i != upstreams->current_stateful);
|
|
||||||
upstream->conn_state = GETDNS_CONN_CLOSED;
|
|
||||||
upstream->conn_backoff_interval = 1;
|
|
||||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_NOTICE,
|
|
||||||
"%-40s : Upstream : No valid upstreams for %s... promoting this backed-off upstream for re-try...\n",
|
|
||||||
upstream->addr_str,
|
|
||||||
upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP");
|
|
||||||
return upstream;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now select the specific upstream */
|
/* Now select the specific upstream */
|
||||||
|
|
Loading…
Reference in New Issue