diff --git a/src/request-internal.c b/src/request-internal.c index 8b5dafdb..ed6f9612 100644 --- a/src/request-internal.c +++ b/src/request-internal.c @@ -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; diff --git a/src/stub.c b/src/stub.c index d24aa6fa..5da85daf 100644 --- a/src/stub.c +++ b/src/stub.c @@ -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); diff --git a/src/types-internal.h b/src/types-internal.h index 76615625..10efae7f 100644 --- a/src/types-internal.h +++ b/src/types-internal.h @@ -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];