Skip to content

Commit

Permalink
[core] allow for multiple fsm state transitions (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
spencersevilla committed Jan 24, 2024
1 parent 9c07511 commit 849a959
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/core/ogs-fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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)
Expand Down

0 comments on commit 849a959

Please sign in to comment.