X-Git-Url: https://git.distorted.org.uk/~mdw/adns/blobdiff_plain/620c146da30a20c2d9a6c572fdd0540558039d0e..d855b532b689db96ca7f3b245ddf2b0bf149431d:/src/event.c diff --git a/src/event.c b/src/event.c index d54d847..adb808b 100644 --- a/src/event.c +++ b/src/event.c @@ -173,7 +173,7 @@ void adns__timeouts(adns_state ads, int act, for (qu= ads->timew.head; qu; qu= nqu) { nqu= qu->next; - if (timercmp(&now,&qu->timeout,<=)) { + if (!timercmp(&now,&qu->timeout,>)) { if (!tv_io) continue; inter_maxtoabs(tv_io,tvbuf,now,qu->timeout); } else { @@ -228,7 +228,6 @@ int adns__pollfds(adns_state ads, struct pollfd pollfds_buf[MAX_POLLFDS]) { abort(); } pollfds_buf[1].fd= ads->tcpsocket; - pollfds_buf[1].revents= 0; return 2; } @@ -454,12 +453,16 @@ void adns_beforeselect(adns_state ads, int *maxfd_io, fd_set *readfds_io, void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds, const fd_set *writefds, const fd_set *exceptfds, const struct timeval *now) { + struct timeval tv_buf; struct pollfd pollfds[MAX_POLLFDS]; - int npollfds; + int npollfds, i; + adns__must_gettimeofday(ads,&now,&tv_buf); + if (!now) return; adns_processtimeouts(ads,now); npollfds= adns__pollfds(ads,pollfds); + for (i=0; ioutput,qu); *answer= qu->answer; if (context_r) *context_r= qu->ctx.ext; + *query_io= qu; free(qu); return 0; }