diff options
author | brian <brian@FreeBSD.org> | 2000-03-14 01:46:31 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2000-03-14 01:46:31 +0000 |
commit | 1fa2af66ede91c633df6c1a766877b1b0d1e016a (patch) | |
tree | bb435caeace8865e63a9450cb54fa00bfac9bcd5 /usr.sbin/ppp/timer.c | |
parent | 9c5b52bb1ff54c68085f3d991416208f25de7639 (diff) | |
download | FreeBSD-src-1fa2af66ede91c633df6c1a766877b1b0d1e016a.zip FreeBSD-src-1fa2af66ede91c633df6c1a766877b1b0d1e016a.tar.gz |
When we stop a timer that's the first in the timer list, ensure
that we adjust that timers `rest' value (with the current getitimer()
values) before using that to adjust the next items `rest' value.
After adjusting that value, restart the timer service so that we've
now got the correct setitimer() values.
Diffstat (limited to 'usr.sbin/ppp/timer.c')
-rw-r--r-- | usr.sbin/ppp/timer.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/ppp/timer.c b/usr.sbin/ppp/timer.c index 144c306..989303d 100644 --- a/usr.sbin/ppp/timer.c +++ b/usr.sbin/ppp/timer.c @@ -133,15 +133,25 @@ StopTimerNoBlock(struct pppTimer *tp) pt = t; if (t) { - if (pt) { + if (pt) pt->next = t->next; - } else { + else { TimerList = t->next; if (TimerList == NULL) /* Last one ? */ timer_TermService(); /* Terminate Timer Service */ } - if (t->next) - t->next->rest += tp->rest; + if (t->next) { + if (!pt) { /* t (tp) was the first in the list */ + struct itimerval itimer; + + if (getitimer(ITIMER_REAL, &itimer) == 0) + t->rest = itimer.it_value.tv_sec * SECTICKS + + itimer.it_value.tv_usec / TICKUNIT; + } + t->next->rest += t->rest; + if (!pt) /* t->next is now the first in the list */ + timer_InitService(1); + } } else { /* Search for any pending expired timers */ pt = NULL; |