[MERGED] libosmo-sccp[master]: xua_as[p]_fsm: Use osmo_timer_del() on FSM cleanup

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Nov 20 20:48:40 UTC 2017


Harald Welte has submitted this change and it was merged.

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


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
---
M src/xua_as_fsm.c
M src/xua_asp_fsm.c
2 files changed, 17 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c
index 59a71ba..5757d63 100644
--- a/src/xua_as_fsm.c
+++ b/src/xua_as_fsm.c
@@ -315,6 +315,13 @@
 	}
 }
 
+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 @@
 	.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
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 1b802ce..e81f0af 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -611,6 +611,13 @@
 	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 @@
 			       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 @@
 		return;
 
 	osmo_ss7_route_destroy(rt);
+	osmo_timer_del(&iafp->pong_timer);
 }
 
 struct osmo_fsm ipa_asp_fsm = {

-- 
To view, visit https://gerrit.osmocom.org/4939
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I670df831d7bc30de48ed4277648a461e1e1968fa
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list