Minor fixes in MDNS code to make sure it does work after the recent loop tightening.

Suppressing the warning about mapping the 64 bit timeout value to a 32 bit integer,
based on the comments that the "maximum timeout used in practice is 6553500ms." If that
really is the case, we do not need to support 64 bit integers in the dict structure.
This commit is contained in:
Christian Huitema 2017-03-22 15:50:26 -07:00
parent 95da0b46e0
commit c653e8502c
4 changed files with 10 additions and 7 deletions

View File

@ -756,7 +756,7 @@ _getdns_upstream_shutdown(getdns_upstream *upstream)
uint16_t conn_retries = upstream->upstreams->tls_connection_retries;
/* [TLS1]TODO: This arbitrary logic at the moment - review and improve!*/
if (upstream->conn_setup_failed >= conn_retries
|| (upstream->conn_shutdowns >= conn_retries*GETDNS_TRANSPORT_FAIL_MULT
|| (upstream->conn_shutdowns >= conn_retries*((unsigned)GETDNS_TRANSPORT_FAIL_MULT)
&& upstream->total_responses == 0)
|| (upstream->conn_completed >= conn_retries &&
upstream->total_responses == 0 &&
@ -3569,10 +3569,12 @@ _get_context_settings(getdns_context* context)
return NULL;
/* int fields */
/* the timeouts are stored as uint64, but the value maximum used in
practice is 6553500ms, so we just trim the value to be on the safe side. */
if ( getdns_dict_set_int(result, "timeout",
context->timeout)
(context->timeout > 0xFFFFFFFFull)? 0xFFFFFFFF: (uint32_t) context->timeout)
|| getdns_dict_set_int(result, "idle_timeout",
context->idle_timeout)
(context->idle_timeout > 0xFFFFFFFFull) ? 0xFFFFFFFF : (uint32_t) context->idle_timeout)
|| getdns_dict_set_int(result, "limit_outstanding_queries",
context->limit_outstanding_queries)
|| getdns_dict_set_int(result, "dnssec_allowed_skew",

View File

@ -585,11 +585,12 @@ getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
/* Check whether the name belongs in the MDNS space */
if (!(r = _getdns_mdns_namespace_check(req)))
{
req->is_dns_request = 0;
req->is_dns_request = 1;
// Submit the query to the MDNS transport.
for (netreq_p = req->netreqs
; !r && (netreq = *netreq_p)
; netreq_p++) {
netreq->owner = req;
if ((r = _getdns_submit_mdns_request(netreq))) {
if (r == DNS_REQ_FINISHED) {
if (return_netreq_p)

View File

@ -1584,7 +1584,7 @@ static getdns_return_t mdns_initialize_continuous_request(getdns_network_req *ne
{
GETDNS_CLEAR_EVENT(dnsreq->loop, &netreq->event);
GETDNS_SCHEDULE_EVENT(
dnsreq->loop, -1, dnsreq->context->timeout,
dnsreq->loop, -1, dnsreq->context->timeout*1000,
getdns_eventloop_event_init(&netreq->event, netreq,
NULL, NULL, mdns_mcast_timeout_cb));
}
@ -1813,7 +1813,7 @@ mdns_udp_write_cb(void *userarg)
return;
}
GETDNS_SCHEDULE_EVENT(
dnsreq->loop, netreq->fd, dnsreq->context->timeout,
dnsreq->loop, netreq->fd, dnsreq->context->timeout*1000,
getdns_eventloop_event_init(&netreq->event, netreq,
mdns_udp_read_cb, NULL, mdns_timeout_cb));
}

View File

@ -862,7 +862,7 @@ _getdns_create_call_reporting_dict(
return NULL;
}
} else{
uint32_t idle_timeout = netreq->upstream->keepalive_timeout;
uint32_t idle_timeout = (uint32_t) netreq->upstream->keepalive_timeout;
if (getdns_dict_set_int( netreq_debug, "idle timeout in ms", idle_timeout)) {
getdns_dict_destroy(netreq_debug);
return NULL;