summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/main.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-04-14 23:48:20 +0000
committerbrian <brian@FreeBSD.org>1997-04-14 23:48:20 +0000
commitaebb5d896e369a2c36a4602db4912e3242a873cb (patch)
tree1368af077c877d79f95a7b9f976e3af37d0df247 /usr.sbin/ppp/main.c
parent387d65afaacec6f13404bfd4fd8e0f0d8ca76eef (diff)
downloadFreeBSD-src-aebb5d896e369a2c36a4602db4912e3242a873cb.zip
FreeBSD-src-aebb5d896e369a2c36a4602db4912e3242a873cb.tar.gz
Make the next number redial ability configurable. The
"set redial pause [times]" command becomes "set redial end-pause[.next-pause] [times]" and next-pause defaults to 3 seconds. This keeps things backwards compatable. Suggested by: ache
Diffstat (limited to 'usr.sbin/ppp/main.c')
-rw-r--r--usr.sbin/ppp/main.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index 04a5d26..bb876af 100644
--- a/usr.sbin/ppp/main.c
+++ b/usr.sbin/ppp/main.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: main.c,v 1.42 1997/04/12 22:58:39 brian Exp $
+ * $Id: main.c,v 1.43 1997/04/13 00:54:43 brian Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@@ -682,19 +682,22 @@ RedialTimeout()
}
static void
-StartRedialTimer()
+StartRedialTimer(Timeout)
+ int Timeout;
{
StopTimer(&RedialTimer);
- if (VarRedialTimeout) {
- LogPrintf(LOG_PHASE_BIT, "Enter pause for redialing.\n");
+ if (Timeout) {
RedialTimer.state = TIMER_STOPPED;
- if (VarRedialTimeout > 0)
- RedialTimer.load = VarRedialTimeout * SECTICKS;
+ if (Timeout > 0)
+ RedialTimer.load = Timeout * SECTICKS;
else
RedialTimer.load = (random() % REDIAL_PERIOD) * SECTICKS;
+ LogPrintf(LOG_PHASE_BIT, "Enter pause (%d) for redialing.\n",
+ RedialTimer.load / SECTICKS);
+
RedialTimer.func = RedialTimeout;
StartTimer(&RedialTimer);
}
@@ -759,7 +762,7 @@ DoLoop()
#endif
modem = OpenModem(mode);
if (modem < 0) {
- StartRedialTimer();
+ StartRedialTimer(VarRedialTimeout);
} else {
tries++; /* Tries are per number, not per list of numbers. */
if (VarDialTries)
@@ -779,21 +782,18 @@ DoLoop()
if (VarNextPhone == NULL)
Cleanup(EX_DIAL); /* Tried all numbers - no luck */
else
- sleep(1); /* Try all numbers in background mode */
+ /* Try all numbers in background mode */
+ StartRedialTimer(VarRedialNextTimeout);
} else if (VarDialTries && tries >= VarDialTries) {
/* I give up ! Can't get through :( */
- StartRedialTimer();
+ StartRedialTimer(VarRedialTimeout);
dial_up = FALSE;
tries = 0;
} else if (VarNextPhone == NULL)
/* Dial failed. Keep quite during redial wait period. */
- StartRedialTimer();
+ StartRedialTimer(VarRedialTimeout);
else
- /*
- * Give the modem a chance to recover, then dial the next
- * number in our list
- */
- sleep(1);
+ StartRedialTimer(VarRedialNextTimeout);
}
}
}
OpenPOWER on IntegriCloud