aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-04-11 02:27:31 +0200
committerHarald Welte <laforge@gnumonks.org>2019-06-04 11:01:33 +0200
commit4c43b5705bafc4ed7e79da4608a17bd823d8d3d6 (patch)
treec9a0e22759cfe1808da85b099e0caf97db2685c1
parentc90eee14119ab117e0c08fa0df2e84e1e33a933d (diff)
fsm.c: Print error message for FSM with allstate_action but no eventslaforge/it_msgq
As suggested by Vadim while reviewing a related fix for ipa_keepalive.c in libosmo-abis (see https://gerrit.osmocom.org/#/c/libosmo-abis/+/13540/), it makes sense to print an error message if anyone registers a FSM that specifies an allstate_action callback but at the same time no events that would ever end up in that callback. Change-Id: I9e73f7363ab15a00843e3f0d1e5776f4be7ebc46
-rw-r--r--src/fsm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fsm.c b/src/fsm.c
index 411797d..ac9e055 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -256,6 +256,9 @@ int osmo_fsm_register(struct osmo_fsm *fsm)
return -EEXIST;
if (fsm->event_names == NULL)
LOGP(DLGLOBAL, LOGL_ERROR, "FSM '%s' has no event names! Please fix!\n", fsm->name);
+
+ if (fsm->allstate_action && !fsm->allstate_event_mask)
+ LOGP(DLGLOBAL, LOGL_ERROR, "FSM '%s' has allstate_action but no allstate_event_mask\n",fsm->name);
llist_add_tail(&fsm->list, &osmo_g_fsms);
INIT_LLIST_HEAD(&fsm->instances);