+static void checktimeouts(adns_state ads, struct timeval now,
+ struct timeval **tv_io, struct timeval *tvbuf) {
+ for (qu= ads->timew; qu; qu= nqu) {
+ nqu= qu->next;
+ if (timercmp(&now,qu->timeout,>)) {
+ DLIST_UNLINK(ads->timew,qu);
+ if (qu->state != state_udp) {
+ query_fail(ads,qu,adns_s_notresponding);
+ } else {
+ adns__query_udp(ads,qu,now);
+ }
+ } else {
+ inter_maxtoabs(tv_io,tvbuf,now,qu->timeout);
+ }
+ }
+}
+
+int adns_callback(adns_state ads, int maxfd,
+ const fd_set *readfds, const fd_set *writefds,
+ const fd_set *exceptfds) {
+ struct timeval now;
+
+ r= gettimeofday(&now,0);
+ if (!r) checktimeouts(ads,now,0,0);
+ return internal_callback(ads,maxfd,readfds,writefds,exceptfds);
+}
+
+/* `Interest' functions - find out which fd's we might be interested in,
+ * and when we want to be called back for a timeout.
+ */
+