Merge pull request #321 from neilcook/stub_fixes

Stub fixes
This commit is contained in:
wtoorop 2017-08-18 15:53:23 +02:00 committed by GitHub
commit 5701fb99c9
1 changed files with 6 additions and 2 deletions

View File

@ -588,6 +588,7 @@ _getdns_cancel_stub_request(getdns_network_req *netreq)
#else #else
close(netreq->fd); close(netreq->fd);
#endif #endif
netreq->fd = -1;
} }
} }
@ -606,6 +607,7 @@ stub_timeout_cb(void *userarg)
#else #else
close(netreq->fd); close(netreq->fd);
#endif #endif
netreq->fd = -1;
netreq->upstream->udp_timeouts++; netreq->upstream->udp_timeouts++;
if (netreq->upstream->udp_timeouts % 100 == 0) if (netreq->upstream->udp_timeouts % 100 == 0)
_getdns_upstream_log(netreq->upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, _getdns_upstream_log(netreq->upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
@ -1413,6 +1415,7 @@ stub_udp_read_cb(void *userarg)
#else #else
close(netreq->fd); close(netreq->fd);
#endif #endif
netreq->fd = -1;
stub_next_upstream(netreq); stub_next_upstream(netreq);
} }
netreq->debug_end_time = _getdns_get_time_as_uintt64(); netreq->debug_end_time = _getdns_get_time_as_uintt64();
@ -1435,8 +1438,8 @@ stub_udp_read_cb(void *userarg)
closesocket(netreq->fd); closesocket(netreq->fd);
#else #else
close(netreq->fd); close(netreq->fd);
netreq->fd = -1;
#endif #endif
netreq->fd = -1;
while (GLDNS_TC_WIRE(netreq->response)) { while (GLDNS_TC_WIRE(netreq->response)) {
DEBUG_STUB("%s %-35s: MSG: %p TC bit set in response \n", STUB_DEBUG_READ, DEBUG_STUB("%s %-35s: MSG: %p TC bit set in response \n", STUB_DEBUG_READ,
__FUNC__, (void*)netreq); __FUNC__, (void*)netreq);
@ -1533,6 +1536,7 @@ stub_udp_write_cb(void *userarg)
#else #else
close(netreq->fd); close(netreq->fd);
#endif #endif
netreq->fd = -1;
stub_next_upstream(netreq); stub_next_upstream(netreq);
} }
netreq->debug_end_time = _getdns_get_time_as_uintt64(); netreq->debug_end_time = _getdns_get_time_as_uintt64();
@ -1958,7 +1962,7 @@ upstream_select(getdns_network_req *netreq)
return &upstreams->upstreams[i]; return &upstreams->upstreams[i];
} }
i+=GETDNS_UPSTREAM_TRANSPORTS; i+=GETDNS_UPSTREAM_TRANSPORTS;
if (i > upstreams->count) if (i >= upstreams->count)
i = 0; i = 0;
} while (i != upstreams->current_udp); } while (i != upstreams->current_udp);