void adns_firsttimeout(adns_state ads,
struct timeval **tv_io, struct timeval *tvbuf,
struct timeval now) {
void adns_firsttimeout(adns_state ads,
struct timeval **tv_io, struct timeval *tvbuf,
struct timeval now) {
adns__timeouts(ads, 0, tv_io,tvbuf, now);
adns__timeouts(ads, 0, tv_io,tvbuf, now);
adns__must_gettimeofday(ads,&now,&tv_buf);
if (now) adns__timeouts(ads, 1, 0,0, *now);
adns__must_gettimeofday(ads,&now,&tv_buf);
if (now) adns__timeouts(ads, 1, 0,0, *now);
struct pollfd pollfds[MAX_POLLFDS];
int i, fd, maxfd, npollfds;
struct pollfd pollfds[MAX_POLLFDS];
int i, fd, maxfd, npollfds;
if (tv_mod && (!*tv_mod || (*tv_mod)->tv_sec || (*tv_mod)->tv_usec)) {
/* The caller is planning to sleep. */
if (tv_mod && (!*tv_mod || (*tv_mod)->tv_sec || (*tv_mod)->tv_usec)) {
/* The caller is planning to sleep. */
}
void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds,
}
void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds,
adns__must_gettimeofday(ads,&now,&tv_buf);
if (!now) goto xit;
adns_processtimeouts(ads,now);
adns__must_gettimeofday(ads,&now,&tv_buf);
if (!now) goto xit;
adns_processtimeouts(ads,now);
maxfd,readfds,writefds,exceptfds,
*now, 0);
xit:
maxfd,readfds,writefds,exceptfds,
*now, 0);
xit:
while (ads->timew.head) {
adns__query_fail(ads->timew.head, adns_s_systemfail);
while (ads->timew.head) {
adns__query_fail(ads->timew.head, adns_s_systemfail);
fd_set readfds, writefds, exceptfds;
struct timeval tvbuf, *tvp;
fd_set readfds, writefds, exceptfds;
struct timeval tvbuf, *tvp;
for (;;) {
r= internal_check(ads,query_io,answer_r,context_r);
if (r != EWOULDBLOCK) break;
for (;;) {
r= internal_check(ads,query_io,answer_r,context_r);
if (r != EWOULDBLOCK) break;
adns_afterselect(ads,maxfd,&readfds,&writefds,&exceptfds,0);
}
}
adns_afterselect(ads,maxfd,&readfds,&writefds,&exceptfds,0);
}
}
r= gettimeofday(&now,0);
if (!r) adns__autosys(ads,now);
r= internal_check(ads,query_io,answer_r,context_r);
r= gettimeofday(&now,0);
if (!r) adns__autosys(ads,now);
r= internal_check(ads,query_io,answer_r,context_r);