[PATCH] libosmocore[master]: fsm: explicitly log attempt to transition to same state

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Dec 15 01:26:36 UTC 2016


Review at  https://gerrit.osmocom.org/1434

fsm: explicitly log attempt to transition to same state

Change-Id: Id4ba74ce54d10ebf42959d5f0d88ea5472cf95a3
---
M src/fsm.c
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/34/1434/1

diff --git a/src/fsm.c b/src/fsm.c
index 034193c..d5c8f96 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -327,6 +327,14 @@
 	uint32_t old_state = fi->state;
 	const struct osmo_fsm_state *st = &fsm->states[fi->state];
 
+	/* refuse nop transition */
+	if (old_state == new_state) {
+		LOGPFSMLSRC(fi, LOGL_ERROR, file, line,
+			    "already in state %s\n",
+			    osmo_fsm_state_name(fsm, old_state));
+		return -EINVAL;
+	}
+
 	/* validate if new_state is a valid state */
 	if (!(st->out_state_mask & (1 << new_state))) {
 		LOGPFSMLSRC(fi, LOGL_ERROR, file, line,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4ba74ce54d10ebf42959d5f0d88ea5472cf95a3
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list