chiark / gitweb /
Regression for poll(2).
[adns.git] / src / event.c
index d54d8479c38151b36e914f298b99e99af1922491..0115e070b287d4d8b3fd7d11c02ee0455ce9f948 100644 (file)
@@ -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; i<npollfds; i++) pollfds[i].revents= POLLIN|POLLOUT|POLLPRI;
   adns__fdevents(ads,
                 pollfds,npollfds,
                 maxfd,readfds,writefds,exceptfds,