handle cases when ppp_close() is called while session is in dead or holdoff phase

This commit is contained in:
Sylvain Rochet 2012-07-22 21:42:56 +02:00
parent 3c122117fc
commit 5552f082e8

View File

@ -519,6 +519,19 @@ ppp_close(ppp_pcb *pcb)
{
int st = 0;
/* dead phase, nothing to do, call the status callback to be consistent */
if (pcb->phase == PHASE_DEAD) {
pcb->link_status_cb(pcb, PPPERR_USER, pcb->link_status_ctx);
return PPPERR_NONE;
}
/* holdoff phase, cancel the reconnection and call the status callback */
if (pcb->phase == PHASE_HOLDOFF) {
sys_untimeout(ppp_do_reopen, pcb);
pcb->link_status_cb(pcb, PPPERR_USER, pcb->link_status_ctx);
return PPPERR_NONE;
}
PPPDEBUG(LOG_DEBUG, ("ppp_close() called\n"));
pcb->settings.persist = 0; /* FIXME: not necessary anymore since persistence is done through link status callback */