From 0340159e079dbcdc5571fbc408c65cb278d8ff02 Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 30 Jan 1997 00:49:50 +0000 Subject: [PATCH] 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. --- usr.sbin/ppp/main.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index ac8657f24deb..5743be0d2a1c 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( 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" ); +#endif + /* Maybe a bit cautious.... */ + TimerServiceRequest = -1; + TimerService(); + TimerServiceRequest = 0; + errno = rem_errno; + } + if ( i < 0 ) { if ( errno == EINTR ) { - if( TimerServiceRequest > 0 ) { -#ifdef DEBUG - logprintf( "Invoking TimerService\n" ); -#endif - /* Maybe a bit cautious.... */ - TimerServiceRequest = -1; - TimerService(); - TimerServiceRequest = 0; - } - continue; /* Got SIGALRM, Do check a queue for dialing */ + continue; /* Got a signal - should have been dealt with */ } perror("select"); break;