chiark / gitweb /
+ * bug_if_query_done feature for debugging (SHOULD BE TAKEN OUT FOR RELEASE)
[adns.git] / src / event.c
index 885ab81032747cb4ba478c84723375fa2791f73c..b82b5de397d9a9e7eeb9f007cc01c41a0d7fe33d 100644 (file)
@@ -540,7 +540,7 @@ void adns_beforeselect(adns_state ads, int *maxfd_io, fd_set *readfds_io,
   if (tv_mod && (!*tv_mod || (*tv_mod)->tv_sec || (*tv_mod)->tv_usec)) {
     /* The caller is planning to sleep. */
     adns__must_gettimeofday(ads,&now,&tv_nowbuf);
-    if (!now) { inter_immed(tv_mod,tv_iobuf); goto xit; }
+    if (!now) { inter_immed(tv_mod,tv_tobuf); goto xit; }
     adns__timeouts(ads, 1, tv_mod,tv_tobuf, *now);
   }
 
@@ -665,7 +665,7 @@ int adns_wait(adns_state ads,
              void **context_r) {
   int r, maxfd, rsel;
   fd_set readfds, writefds, exceptfds;
-  struct timeval *now, nowbuf, tvbuf, *tvp;
+  struct timeval tvbuf, *tvp;
   
   adns__consistency(ads,*query_io,cc_entex);
   for (;;) {
@@ -673,7 +673,9 @@ int adns_wait(adns_state ads,
     if (r != EAGAIN) break;
     maxfd= 0; tvp= 0;
     FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds);
+    ads->bug_if_query_done_now= 1;
     adns_beforeselect(ads,&maxfd,&readfds,&writefds,&exceptfds,&tvp,&tvbuf,0);
+    ads->bug_if_query_done_now= 0;
     assert(tvp);
     rsel= select(maxfd,&readfds,&writefds,&exceptfds,tvp);
     if (rsel==-1) {