Skip to content

Commit

Permalink
fix(fsm): execute the event before ExitEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
free5gc-org committed Mar 31, 2022
1 parent 427fece commit a15e1dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fsm/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ func (fsm *FSM) SendEvent(state *State, event EventType, args ArgsType) error {
if trans, ok := fsm.transitions[key]; ok {
logger.FsmLog.Infof("Handle event[%s], transition from [%s] to [%s]", event, trans.From, trans.To)

// event callback
fsm.callbacks[trans.From](state, event, args)

// exit callback
if trans.From != trans.To {
fsm.callbacks[trans.From](state, ExitEvent, args)
}

// event callback
fsm.callbacks[trans.From](state, event, args)

// entry callback
if trans.From != trans.To {
state.Set(trans.To)
Expand Down

0 comments on commit a15e1dc

Please sign in to comment.