From 1813f1f9aca0cb14341878b418f6001671b8cb0b Mon Sep 17 00:00:00 2001 From: Spencer Sevilla Date: Wed, 1 Feb 2023 10:07:19 -0800 Subject: [PATCH] [core] allow for multiple fsm state transitions (#72) --- lib/core/ogs-fsm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/core/ogs-fsm.c b/lib/core/ogs-fsm.c index 0e6990cd5d..746c05cd7c 100644 --- a/lib/core/ogs-fsm.c +++ b/lib/core/ogs-fsm.c @@ -117,6 +117,7 @@ void ogs_fsm_dispatch(void *fsm, void *event) ogs_fsm_t *sm = fsm; fsm_event_t *e = event; ogs_fsm_handler_t tmp = NULL; + ogs_fsm_handler_t t2 = NULL; ogs_assert(sm); @@ -126,8 +127,11 @@ void ogs_fsm_dispatch(void *fsm, void *event) if (e) (*tmp)(sm, e); - if (sm->state != tmp) + while (sm->state && sm->state != tmp) { + t2 = sm->state; fsm_change(fsm, tmp, sm->state, e); + tmp = t2; + } } void ogs_fsm_fini(void *fsm, void *event)