Change in ...libosmocore[master]: fsm.c: Print error message for FSM with allstate_action but no events

laforge gerrit-no-reply at lists.osmocom.org
Sat Jun 15 11:20:36 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/libosmocore/+/14361 )

Change subject: fsm.c: Print error message for FSM with allstate_action but no events
......................................................................

fsm.c: Print error message for FSM with allstate_action but no events

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

Approvals:
  laforge: Looks good to me, approved
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/fsm.c b/src/fsm.c
index 337786d..04c583b 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -256,6 +256,17 @@
 		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);
+	}
+
+	if (!fsm->allstate_action && fsm->allstate_event_mask) {
+		LOGP(DLGLOBAL, LOGL_ERROR, "FSM '%s' has allstate_event_mask but no allstate_action\n",
+			fsm->name);
+	}
+
 	llist_add_tail(&fsm->list, &osmo_g_fsms);
 	INIT_LLIST_HEAD(&fsm->instances);
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14361
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9e73f7363ab15a00843e3f0d1e5776f4be7ebc46
Gerrit-Change-Number: 14361
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190615/b78be4a9/attachment.html>


More information about the gerrit-log mailing list