From dad51e5ce8a405b90a5086a3fe73a81d72e8dfe7 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Tue, 23 Oct 2001 13:52:19 +0000 Subject: [PATCH] Don't avoid setting a 0 second timer in datalink_StartDialTimer() by not setting any timer. Instead, set a 1 millisecond timer. This ensures that ppp will come out of it's select() call after losing carrier in -ddial mode with a reconnect period of 0 and going to ST_OPENING, rather than waiting indefinitely for some other event to wake ppp up. Bump the ppp version number to indicate the event. MFC after: 3 days --- usr.sbin/ppp/command.c | 2 +- usr.sbin/ppp/datalink.c | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index ae68eec0701..3da1db25c0e 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -164,7 +164,7 @@ #define NEG_MPPE 54 #define NEG_CHAP81 55 -const char Version[] = "3.0.0"; +const char Version[] = "3.0.1"; static int ShowCommand(struct cmdargs const *); static int TerminalCommand(struct cmdargs const *); diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c index 3781023abe5..1bbf3cc9cb7 100644 --- a/usr.sbin/ppp/datalink.c +++ b/usr.sbin/ppp/datalink.c @@ -97,18 +97,16 @@ datalink_StartDialTimer(struct datalink *dl, int Timeout) int result = Timeout; timer_Stop(&dl->dial.timer); - if (Timeout) { - if (Timeout < 0) - result = (random() % DIAL_TIMEOUT) + 1; - dl->dial.timer.load = result * SECTICKS; - dl->dial.timer.func = datalink_OpenTimeout; - dl->dial.timer.name = "dial"; - dl->dial.timer.arg = dl; - timer_Start(&dl->dial.timer); - if (dl->state == DATALINK_OPENING) - log_Printf(LogPHASE, "%s: Enter pause (%d) for redialing.\n", - dl->name, result); - } + if (Timeout < 0) + result = (random() % DIAL_TIMEOUT) + 1; + dl->dial.timer.load = result ? result * SECTICKS : 1; + dl->dial.timer.func = datalink_OpenTimeout; + dl->dial.timer.name = "dial"; + dl->dial.timer.arg = dl; + timer_Start(&dl->dial.timer); + if (dl->state == DATALINK_OPENING) + log_Printf(LogPHASE, "%s: Enter pause (%d) for redialing.\n", + dl->name, result); return result; }