--- multiplexer/dispatch.c 2001/04/11 20:40:57 1.4 +++ multiplexer/dispatch.c 2001/05/02 16:27:12 1.5 @@ -50,6 +50,7 @@ void dispatch (void) stream_descr *st; t_msec tmo; unsigned int nfds, onfds, infds; + int pollresult; struct pollfd ufds [MAX_POLLFD]; warn (LDEB,"Dispatch",EDIS,0,0,0); bs = FALSE; @@ -75,18 +76,6 @@ void dispatch (void) warn (LDEB,"Poll",EDIS,0,1,tmo); #ifdef DEBUG_TIMEPOLL ltp->tmo = tmo; -#endif - if (!timed_io) { - if (tmo > 0) { - global_delta += tmo; - tmo = 0; - warn (LDEB,"Global Delta",EDIS,0,3,global_delta); -#ifdef DEBUG_TIMEPOLL - ltp->flags |= LTP_FLAG_DELTASHIFT; -#endif - } - } -#ifdef DEBUG_TIMEPOLL if (ltp->usec != 0) { struct timeval tv; gettimeofday (&tv,NULL); @@ -104,7 +93,17 @@ void dispatch (void) ltp->so = output_free (); ltp->nfdsrevent = #endif - poll (&ufds[0], nfds, tmo); + pollresult = + poll (&ufds[0], nfds, ((!timed_io) && (tmo > 0)) ? 0 : tmo); + if ((!timed_io) && (tmo > 0)) { + if (pollresult == 0) { + global_delta += tmo; + warn (LDEB,"Global Delta",EDIS,0,3,global_delta); +#ifdef DEBUG_TIMEPOLL + ltp->flags |= LTP_FLAG_DELTASHIFT; +#endif + } + } #ifdef DEBUG_TIMEPOLL if (logtpc < (max_timepoll-1)) { struct timeval tv; @@ -123,6 +122,7 @@ void dispatch (void) && (ufds[onfds].revents & (POLLOUT | POLLHUP | POLLERR))) { output_something (ufds[onfds].revents & POLLOUT); } + output_gen_statistics (); if (bi) { while (infds < nfds) { if (ufds[infds].revents & (POLLIN | POLLHUP | POLLERR)) {