xua_as[p]_fsm: Use osmo_timer_del() on FSM cleanup

When we destroy a FSM, we (logically) must osmo_timer_del() any running
timers that the FSM might have been using.  This was not implemented
for xua_as_fsm, xua_asp_fsm and also missing from ipa_asp_fsm.

Change-Id: I670df831d7bc30de48ed4277648a461e1e1968fa
Related: OS#2668
This commit is contained in:
Harald Welte 2017-11-20 21:00:37 +01:00
parent 646f47d5a3
commit 081ac9c029
2 changed files with 17 additions and 0 deletions

View File

@ -315,6 +315,13 @@ static void xua_as_fsm_pending(struct osmo_fsm_inst *fi, uint32_t event, void *d
}
}
static void xua_as_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
{
struct xua_as_fsm_priv *xafp = (struct xua_as_fsm_priv *) fi->priv;
osmo_timer_del(&xafp->recovery.t_r);
}
static const struct osmo_fsm_state xua_as_fsm_states[] = {
[XUA_AS_S_DOWN] = {
.in_event_mask = S(XUA_ASPAS_ASP_INACTIVE_IND) |
@ -368,6 +375,7 @@ struct osmo_fsm xua_as_fsm = {
.num_states = ARRAY_SIZE(xua_as_fsm_states),
.log_subsys = DLSS7,
.event_names = xua_as_event_names,
.cleanup = xua_as_fsm_cleanup,
};
/*! \brief Start an AS FSM for a given Application Server

View File

@ -611,6 +611,13 @@ static int xua_asp_fsm_timer_cb(struct osmo_fsm_inst *fi)
return 0;
}
static void xua_asp_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
{
struct xua_asp_fsm_priv *xafp = fi->priv;
osmo_timer_del(&xafp->t_ack.timer);
}
static const struct osmo_fsm_state xua_asp_states[] = {
[XUA_ASP_S_DOWN] = {
.in_event_mask = S(XUA_ASP_E_M_ASP_UP_REQ) |
@ -668,6 +675,7 @@ struct osmo_fsm xua_asp_fsm = {
S(XUA_ASP_E_ASPSM_BEAT) |
S(XUA_ASP_E_ASPSM_BEAT_ACK),
.allstate_action = xua_asp_allstate,
.cleanup = xua_asp_fsm_cleanup,
};
static struct osmo_fsm_inst *ipa_asp_fsm_start(struct osmo_ss7_asp *asp,
@ -1040,6 +1048,7 @@ static void ipa_asp_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cau
return;
osmo_ss7_route_destroy(rt);
osmo_timer_del(&iafp->pong_timer);
}
struct osmo_fsm ipa_asp_fsm = {