Merge pull request #520 from SharmaShikha-84/master

Fix for issue in UDP stream selection in case of timeouts.
This commit is contained in:
Willem Toorop 2022-08-10 14:31:18 +02:00 committed by GitHub
commit 861ae30725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -709,6 +709,8 @@ static void
stub_timeout_cb(void *userarg)
{
getdns_network_req *netreq = (getdns_network_req *)userarg;
getdns_upstream *upstream = netreq? netreq->upstream: NULL;
getdns_upstreams *upstreams = upstream? upstream->upstreams: NULL;
DEBUG_STUB("%s %-35s: MSG: %p\n",
STUB_DEBUG_CLEANUP, __FUNC__, (void*)netreq);
stub_cleanup(netreq);
@ -723,7 +725,9 @@ stub_timeout_cb(void *userarg)
"%-40s : Upstream : UDP - Resps=%6d, Timeouts =%6d (logged every 100 responses)\n",
netreq->upstream->addr_str,
(int)netreq->upstream->udp_responses, (int)netreq->upstream->udp_timeouts);
stub_next_upstream(netreq);
/* Only choose next stream if the timeout is on current UDP stream */
if (upstreams && (upstream == &upstreams->upstreams[upstreams->current_udp]))
stub_next_upstream(netreq);
} else {
netreq->upstream->responses_timeouts++;
}