[MERGED] libosmocore[master]: fsm: Re-set fsm_inst->T to 0 after timer expiration

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
Sun Apr 16 17:23:57 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: fsm: Re-set fsm_inst->T to 0 after timer expiration
......................................................................


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
---
M src/fsm.c
1 file changed, 4 insertions(+), 1 deletion(-)

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



diff --git a/src/fsm.c b/src/fsm.c
index 7b2be70..9e6ef15 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -178,13 +178,16 @@
 
 	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);
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I71167ec1000dc4c6954d851d3b92f6bf12984925
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
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