X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/adns/blobdiff_plain/c6f9dc7b9895537e6b56d4b363f27867a5142b16..a225dda5a42c61fc6befec3e4e8ba39c32fc93db:/src/event.c diff --git a/src/event.c b/src/event.c index b2da291..e3f72a4 100644 --- a/src/event.c +++ b/src/event.c @@ -183,7 +183,12 @@ void adns__timeouts(adns_state ads, int act, if (!tv_io) continue; inter_maxtoabs(tv_io,tvbuf,now,qu->timeout); } else { - if (!act) continue; + if (!act) { + tvbuf->tv_sec= 0; + tvbuf->tv_usec= 0; + *tv_io= tvbuf; + return; + } LIST_UNLINK(ads->timew,qu); if (qu->state != query_tosend) { adns__query_fail(qu,adns_s_timeout); @@ -565,8 +570,13 @@ int adns__internal_check(adns_state ads, qu= *query_io; if (!qu) { - if (!ads->output.head) return EAGAIN; - qu= ads->output.head; + if (ads->output.head) { + qu= ads->output.head; + } else if (ads->timew.head) { + return EAGAIN; + } else { + return ESRCH; + } } else { if (qu->id>=0) return EAGAIN; }