Tidy up the use of struct pppTimer.

This commit is contained in:
Brian Somers 1998-04-19 15:24:50 +00:00
parent 1ad3093b3f
commit e3c70ce931
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=35297
10 changed files with 16 additions and 28 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: auth.c,v 1.27.2.20 1998/04/07 00:53:18 brian Exp $
* $Id: auth.c,v 1.27.2.21 1998/04/16 00:25:47 brian Exp $
*
* TODO:
* o Implement check against with registered IP addresses.
@ -203,7 +203,6 @@ StartAuthChallenge(struct authinfo *authp, struct physical *physical,
authp->authtimer.func = AuthTimeout;
authp->authtimer.name = "auth";
authp->authtimer.load = authp->cfg.fsmretry * SECTICKS;
authp->authtimer.state = TIMER_STOPPED;
authp->authtimer.arg = (void *) authp;
authp->retry = 3;
authp->id = 1;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bundle.c,v 1.1.2.52 1998/04/17 22:05:03 brian Exp $
* $Id: bundle.c,v 1.1.2.53 1998/04/18 23:17:23 brian Exp $
*/
#include <sys/types.h>
@ -906,7 +906,6 @@ bundle_StartIdleTimer(struct bundle *bundle)
bundle->idle.timer.func = bundle_IdleTimeout;
bundle->idle.timer.name = "idle";
bundle->idle.timer.load = bundle->cfg.idle_timeout * SECTICKS;
bundle->idle.timer.state = TIMER_STOPPED;
bundle->idle.timer.arg = bundle;
StartTimer(&bundle->idle.timer);
bundle->idle.done = time(NULL) + bundle->cfg.idle_timeout;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: chat.c,v 1.44.2.23 1998/04/18 01:01:15 brian Exp $
* $Id: chat.c,v 1.44.2.24 1998/04/18 23:17:24 brian Exp $
*/
#include <sys/types.h>
@ -77,7 +77,6 @@ chat_PauseTimer(void *v)
{
struct chat *c = (struct chat *)v;
StopTimer(&c->pause);
c->pause.state = TIMER_STOPPED;
c->pause.load = 0;
}
@ -85,7 +84,6 @@ static void
chat_Pause(struct chat *c, u_long load)
{
StopTimer(&c->pause);
c->pause.state = TIMER_STOPPED;
c->pause.load += load;
c->pause.func = chat_PauseTimer;
c->pause.name = "chat pause";
@ -105,7 +103,6 @@ static void
chat_SetTimeout(struct chat *c)
{
StopTimer(&c->timeout);
c->timeout.state = TIMER_STOPPED;
if (c->TimeoutSec > 0) {
c->timeout.load = SECTICKS * c->TimeoutSec;
c->timeout.func = chat_TimeoutTimer;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: datalink.c,v 1.1.2.40 1998/04/18 01:01:19 brian Exp $
* $Id: datalink.c,v 1.1.2.41 1998/04/18 23:17:25 brian Exp $
*/
#include <sys/types.h>
@ -85,7 +85,6 @@ datalink_StartDialTimer(struct datalink *dl, int Timeout)
StopTimer(&dl->dial_timer);
if (Timeout) {
dl->dial_timer.state = TIMER_STOPPED;
if (Timeout > 0)
dl->dial_timer.load = Timeout * SECTICKS;
else

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: fsm.c,v 1.27.2.27 1998/04/07 00:53:41 brian Exp $
* $Id: fsm.c,v 1.27.2.28 1998/04/16 00:25:58 brian Exp $
*
* TODO:
*/
@ -163,7 +163,7 @@ NewState(struct fsm * fp, int new)
if ((new >= ST_INITIAL && new <= ST_STOPPED) || (new == ST_OPENED)) {
StopTimer(&fp->FsmTimer);
if (new == ST_STOPPED && fp->StoppedTimer.load) {
fp->StoppedTimer.state = TIMER_STOPPED;
StopTimer(&fp->StoppedTimer);
fp->StoppedTimer.func = StoppedTimeout;
fp->StoppedTimer.arg = (void *) fp;
StartTimer(&fp->StoppedTimer);
@ -235,7 +235,7 @@ FsmOpen(struct fsm * fp)
LogPrintf(LogPHASE, "Entering STOPPED state for %d seconds\n",
fp->open_mode);
NewState(fp, ST_STOPPED);
fp->OpenTimer.state = TIMER_STOPPED;
StopTimer(&fp->OpenTimer);
fp->OpenTimer.load = fp->open_mode * SECTICKS;
fp->OpenTimer.func = FsmOpenNow;
fp->OpenTimer.arg = (void *)fp;
@ -412,7 +412,6 @@ static void
FsmInitRestartCounter(struct fsm * fp)
{
StopTimer(&fp->FsmTimer);
fp->FsmTimer.state = TIMER_STOPPED;
fp->FsmTimer.func = FsmTimeout;
fp->FsmTimer.arg = (void *) fp;
(*fp->fn->InitRestartCounter)(fp);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: hdlc.c,v 1.28.2.25 1998/04/07 00:53:43 brian Exp $
* $Id: hdlc.c,v 1.28.2.26 1998/04/18 01:01:22 brian Exp $
*
* TODO:
*/
@ -593,7 +593,6 @@ hdlc_ReportTime(void *v)
struct hdlc *hdlc = (struct hdlc *)v;
StopTimer(&hdlc->ReportTimer);
hdlc->ReportTimer.state = TIMER_STOPPED;
if (memcmp(&hdlc->laststats, &hdlc->stats, sizeof hdlc->stats)) {
LogPrintf(LogPHASE,
@ -612,7 +611,6 @@ void
hdlc_StartTimer(struct hdlc *hdlc)
{
StopTimer(&hdlc->ReportTimer);
hdlc->ReportTimer.state = TIMER_STOPPED;
hdlc->ReportTimer.load = 60 * SECTICKS;
hdlc->ReportTimer.arg = hdlc;
hdlc->ReportTimer.func = hdlc_ReportTime;

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: lqr.c,v 1.22.2.23 1998/04/16 00:26:07 brian Exp $
* $Id: lqr.c,v 1.22.2.24 1998/04/18 01:01:24 brian Exp $
*
* o LQR based on RFC1333
*
@ -235,7 +235,6 @@ StartLqm(struct lcp *lcp)
LogPrintf(LogLQM, "Will send %s every %d.%02d secs\n",
physical->hdlc.lqm.method & LQM_LQR ? "LQR" : "ECHO LQR",
lcp->want_lqrperiod / 100, lcp->want_lqrperiod % 100);
physical->hdlc.lqm.timer.state = TIMER_STOPPED;
physical->hdlc.lqm.timer.load = lcp->want_lqrperiod * SECTICKS / 100;
physical->hdlc.lqm.timer.func = SendLqrReport;
physical->hdlc.lqm.timer.name = "lqm";

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: modem.c,v 1.77.2.50 1998/04/16 00:26:09 brian Exp $
* $Id: modem.c,v 1.77.2.51 1998/04/17 22:04:32 brian Exp $
*
* TODO:
*/
@ -325,7 +325,6 @@ modem_StartTimer(struct bundle *bundle, struct physical *modem)
ModemTimer = &modem->link.Timer;
StopTimer(ModemTimer);
ModemTimer->state = TIMER_STOPPED;
ModemTimer->load = SECTICKS;
ModemTimer->func = modem_Timeout;
ModemTimer->name = "modem CD";

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: prompt.c,v 1.1.2.26 1998/04/14 23:17:10 brian Exp $
* $Id: prompt.c,v 1.1.2.27 1998/04/18 01:01:27 brian Exp $
*/
#include <sys/param.h>
@ -505,7 +505,6 @@ prompt_Continue(struct prompt *p)
bgtimer.func = prompt_TimedContinue;
bgtimer.name = "prompt bg";
bgtimer.load = SECTICKS;
bgtimer.state = TIMER_STOPPED;
bgtimer.arg = p;
StartTimer(&bgtimer);
}

View File

@ -23,12 +23,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: throughput.c,v 1.4.4.6 1998/04/10 13:19:23 brian Exp $
* $Id: throughput.c,v 1.4.4.7 1998/04/16 00:26:18 brian Exp $
*/
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <time.h>
@ -47,6 +48,7 @@ throughput_init(struct pppThroughput *t)
for (f = 0; f < SAMPLE_PERIOD; f++)
t->SampleOctets[f] = 0;
t->OctetsPerSecond = t->BestOctetsPerSecond = t->nSample = 0;
memset(&t->Timer, '\0', sizeof t->Timer);
t->Timer.name = "throughput";
t->uptime = 0;
t->rolling = 0;
@ -107,7 +109,6 @@ throughput_sampler(void *v)
u_long old;
StopTimer(&t->Timer);
t->Timer.state = TIMER_STOPPED;
old = t->SampleOctets[t->nSample];
t->SampleOctets[t->nSample] = t->OctetsIn + t->OctetsOut;
@ -123,11 +124,11 @@ throughput_sampler(void *v)
void
throughput_start(struct pppThroughput *t, const char *name, int rolling)
{
StopTimer(&t->Timer);
throughput_init(t);
t->rolling = rolling ? 1 : 0;
time(&t->uptime);
if (t->rolling) {
t->Timer.state = TIMER_STOPPED;
t->Timer.load = SECTICKS;
t->Timer.func = throughput_sampler;
t->Timer.name = name;
@ -139,8 +140,7 @@ throughput_start(struct pppThroughput *t, const char *name, int rolling)
void
throughput_stop(struct pppThroughput *t)
{
if (t->rolling)
StopTimer(&t->Timer);
StopTimer(&t->Timer);
}
void