diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2018-02-08 13:15:49 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-02-09 02:25:58 +0000 |
commit | 5ec91980ac2224aa1e9bf070a0e382d0d8c2b729 (patch) | |
tree | e55ce8e9b2a6a7698120f0ba875e8530f703b966 | |
parent | 572177063d4cf2416b9f622d5031212204563720 (diff) |
fsm: do not terminate child FSMs early
The function _osmo_fsm_inst_term() terminates all child FSMs befor
it calls fi->fsm_cleanup(). This prevnts the cleanup callback to
perform last actions on the child FSMs (e.g.
osmo_fsm_inst_unlink_parent()).
move the function call to _osmo_fsm_inst_term_children() below the
call to fi->fsm->cleanup().
Change-Id: Ie89d435417306c6bf897274eabc3ed0a46485c26
-rw-r--r-- | src/fsm.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -509,9 +509,6 @@ void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", osmo_fsm_term_cause_name(cause)); - _osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL, - file, line); - /* delete ourselves from the parent */ parent = fi->proc.parent; if (parent) { @@ -524,6 +521,10 @@ void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, if (fi->fsm->cleanup) fi->fsm->cleanup(fi, cause); + /* terminate all children */ + _osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL, + file, line); + LOGPFSMSRC(fi, file, line, "Freeing instance\n"); /* Fetch parent again in case it has changed. */ parent = fi->proc.parent; |