global_nameserver_timeouts_length - 1)];
ns->failed_times++;
- evtimer_assign(&ns->timeout_event, ns->base->event_base, nameserver_prod_callback, ns);
-
if (evtimer_add(&ns->timeout_event, (struct timeval *) timeout) < 0) {
log(EVDNS_LOG_WARN,
"Error from libevent when adding timer event for %s",
ns->state = 0;
ns->failed_times = 1;
- evtimer_assign(&ns->timeout_event, ns->base->event_base, nameserver_prod_callback, ns);
-
if (evtimer_add(&ns->timeout_event, (struct timeval *) &global_nameserver_timeouts[0]) < 0) {
log(EVDNS_LOG_WARN,
"Error from libevent when adding timer event for %s",
/* all ok */
log(EVDNS_LOG_DEBUG,
"Setting timeout for request %lx", (unsigned long) req);
- evtimer_assign(&req->timeout_event, req->base->event_base, evdns_request_timeout_callback, req);
-
if (evtimer_add(&req->timeout_event, &req->base->global_timeout) < 0) {
log(EVDNS_LOG_WARN,
"Error from libevent when adding timer for request %lx",
memset(ns, 0, sizeof(struct nameserver));
ns->base = base;
+ evtimer_assign(&ns->timeout_event, ns->base->event_base, nameserver_prod_callback, ns);
+
ns->socket = socket(PF_INET, SOCK_DGRAM, 0);
if (ns->socket < 0) { err = 1; goto out1; }
evutil_make_socket_nonblocking(ns->socket);
memset(req, 0, sizeof(struct evdns_request));
req->base = base;
+ evtimer_assign(&req->timeout_event, req->base->event_base, evdns_request_timeout_callback, req);
+
if (base->global_randomize_case) {
unsigned i;
char randbits[(sizeof(namebuf)+7)/8];