1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

libcli/dns: Time out requests after a while

Time out UDP requests after DNS_REQUEST_TIMEOUT seconds. Currently set
to 2 seconds.

This should fix bug #8878.

Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 16 12:58:32 CEST 2012 on sn-devel-104
This commit is contained in:
Kai Blin 2012-10-13 02:09:57 +02:00 committed by Jeremy Allison
parent 1861213d14
commit 05a5974891

View File

@ -38,6 +38,8 @@ struct dns_udp_request_state {
size_t reply_len;
};
#define DNS_REQUEST_TIMEOUT 2
/* Declare callback functions used below. */
static void dns_udp_request_get_reply(struct tevent_req *subreq);
static void dns_udp_request_done(struct tevent_req *subreq);
@ -92,6 +94,12 @@ struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev);
}
if (!tevent_req_set_endtime(req, ev,
timeval_current_ofs(DNS_REQUEST_TIMEOUT, 0))) {
return tevent_req_post(req, ev);
}
tevent_req_set_callback(subreq, dns_udp_request_get_reply, req);
return req;
}