diff options
author | brian <brian@FreeBSD.org> | 1997-01-30 00:49:50 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-01-30 00:49:50 +0000 |
commit | 0340159e079dbcdc5571fbc408c65cb278d8ff02 (patch) | |
tree | c91ffce82ee11ef0df1bc04d8bfc6f5e816304e8 /usr.sbin/ppp/main.c | |
parent | 264fc79b213bb942af9be8061cafa89eb07aff14 (diff) | |
download | FreeBSD-src-0340159e079dbcdc5571fbc408c65cb278d8ff02.zip FreeBSD-src-0340159e079dbcdc5571fbc408c65cb278d8ff02.tar.gz |
Check the timer request flag irrespective of wheter select() came back with
EINTR - it's possible that it happened at some other point in the loop.
Diffstat (limited to 'usr.sbin/ppp/main.c')
-rw-r--r-- | usr.sbin/ppp/main.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index ac8657f..5743be0 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -790,6 +790,17 @@ DoLoop() #ifndef SIGALRM usleep(TICKUNIT); TimerService(); +#else + if( TimerServiceRequest > 0 ) { +#ifdef DEBUG + logprintf( "Invoking TimerService before select()\n" ); +#endif + /* Maybe a bit cautious.... */ + TimerServiceRequest = -1; + TimerService(); + TimerServiceRequest = 0; + continue; + } #endif /* If there are aren't many packets queued, look for some more. */ @@ -823,18 +834,23 @@ DoLoop() continue; } - if ( i < 0 ) { - if ( errno == EINTR ) { - if( TimerServiceRequest > 0 ) { + if( TimerServiceRequest > 0 ) { + /* we want to service any SIGALRMs even if we got it before calling + select. */ + int rem_errno = errno; #ifdef DEBUG - logprintf( "Invoking TimerService\n" ); + logprintf( "Invoking TimerService\n" ); #endif - /* Maybe a bit cautious.... */ - TimerServiceRequest = -1; - TimerService(); - TimerServiceRequest = 0; - } - continue; /* Got SIGALRM, Do check a queue for dialing */ + /* Maybe a bit cautious.... */ + TimerServiceRequest = -1; + TimerService(); + TimerServiceRequest = 0; + errno = rem_errno; + } + + if ( i < 0 ) { + if ( errno == EINTR ) { + continue; /* Got a signal - should have been dealt with */ } perror("select"); break; |