Don't retry an already tried upstream

This commit is contained in:
Willem Toorop 2018-03-02 15:56:00 +01:00
parent 8797280429
commit b178f94505
3 changed files with 7 additions and 0 deletions

View File

@ -201,6 +201,7 @@ network_req_init(getdns_network_req *net_req, getdns_dns_req *owner,
/* state variables from the resolver, don't touch
*/
net_req->first_upstream = NULL;
net_req->upstream = NULL;
net_req->fd = -1;
net_req->transport_current = 0;

View File

@ -2296,8 +2296,13 @@ upstream_find_for_netreq(getdns_network_req *netreq)
return STUB_TRY_AGAIN_LATER;
return -1;
}
if (upstream == netreq->first_upstream)
continue;
netreq->transport_current = i;
netreq->upstream = upstream;
if (!netreq->first_upstream)
netreq->first_upstream = upstream;
netreq->keepalive_sent = 0;
DEBUG_STUB("%s %-35s: MSG: %p found upstream %p with transport %d, fd: %d\n", STUB_DEBUG_SCHEDULE, __FUNC__, (void*)netreq, (void *)upstream, (int)netreq->transports[i], fd);

View File

@ -221,6 +221,7 @@ typedef struct getdns_network_req
getdns_redirects_t follow_redirects;
/* For stub resolving */
struct getdns_upstream *first_upstream;
struct getdns_upstream *upstream;
int fd;
getdns_transport_list_t transports[GETDNS_TRANSPORTS_MAX];