ppp: Stop the timer when re-starting

In case we receive NAK/REJ we should stop and re-start the timer,
otherwise we end up generating multiple Conf-Reqs
This commit is contained in:
Denis Kenzior 2010-04-08 19:47:58 -05:00
parent cad3223a94
commit 8f5459ffbc
1 changed files with 9 additions and 10 deletions

View File

@ -274,16 +274,6 @@ static gboolean pppcp_timeout(gpointer user_data)
return FALSE;
}
static void pppcp_start_timer(struct pppcp_timer_data *timer_data)
{
if (timer_data->restart_timer)
return;
timer_data->restart_timer =
g_timeout_add_seconds(timer_data->restart_interval,
pppcp_timeout, timer_data);
}
static void pppcp_stop_timer(struct pppcp_timer_data *timer_data)
{
if (timer_data->restart_timer) {
@ -292,6 +282,15 @@ static void pppcp_stop_timer(struct pppcp_timer_data *timer_data)
}
}
static void pppcp_start_timer(struct pppcp_timer_data *timer_data)
{
pppcp_stop_timer(timer_data);
timer_data->restart_timer =
g_timeout_add_seconds(timer_data->restart_interval,
pppcp_timeout, timer_data);
}
static gboolean is_first_request(struct pppcp_timer_data *timer_data)
{
return (timer_data->restart_counter == timer_data->max_counter);