summaryrefslogtreecommitdiffstats
path: root/src/fsm.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-04-16 17:24:46 +0200
committerHarald Welte <laforge@gnumonks.org>2017-04-16 17:28:23 +0200
commit9e83c3d5ca64428befe74e5aad61bd84bccaf309 (patch)
treef5c56ca256f88cd37afbc28851dac971547250f4 /src/fsm.c
parent4585e6755dd569ab620c711f20a3d45d4ad87216 (diff)
fsm: Re-set fsm_inst->T to 0 after timer expiration
If the user starts the FSM timer with a given timer number during fsm_inst_state_chg() with a timeout, we should remove that "T" number after timer expiration. Otherwise it might be confusing if e.g. the VTY interface shows FSM instances with a certain timer number assigned, but that timer is not actually running anymore. Change-Id: I71167ec1000dc4c6954d851d3b92f6bf12984925
Diffstat (limited to 'src/fsm.c')
-rw-r--r--src/fsm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fsm.c b/src/fsm.c
index 7b2be701..9e6ef156 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -178,13 +178,16 @@ static void fsm_tmr_cb(void *data)
if (fsm->timer_cb) {
int rc = fsm->timer_cb(fi);
- if (rc != 1)
+ if (rc != 1) {
+ fi->T = 0;
return;
+ }
LOGPFSM(fi, "timer_cb requested termination\n");
} else
LOGPFSM(fi, "No timer_cb, automatic termination\n");
/* if timer_cb returns 1 or there is no timer_cb */
+ fi->T = 0;
osmo_fsm_inst_term(fi, OSMO_FSM_TERM_TIMEOUT, &T);
}