mirror of https://gerrit.osmocom.org/libosmocore
contrib/fsm-to-dot: allow transition from and to the same state
In osmo-bsc's new gscon FSM, there is an osmo_fsm_inst_state_chg() from ST_ACTIVE to ST_ACTIVE. Avoid an exception triggering on this simple fact. Change-Id: I420c7be84e3af555cc5e8bddbff7261013348375
This commit is contained in:
parent
167f808d76
commit
46145e80ec
|
@ -205,9 +205,11 @@ class State:
|
||||||
out_edge.add_events(edge.events)
|
out_edge.add_events(edge.events)
|
||||||
out_edge.add_actions(edge.actions)
|
out_edge.add_actions(edge.actions)
|
||||||
return
|
return
|
||||||
# sanity
|
elif out_edge.to_state.get_label() == edge.to_state.get_label():
|
||||||
if out_edge.to_state.get_label() == edge.to_state.get_label():
|
# sanity: there already is an edge to a state that a) is not identical to the target state of the
|
||||||
raise Exception('Two distinct states exist with identical labels.')
|
# newly added edge but b) has the same label.
|
||||||
|
raise Exception('Two distinct states exist with identical label: %r: states %r and %r.'
|
||||||
|
% (out_edge.to_state.get_label(), out_edge.to_state, edge.to_state))
|
||||||
state.out_edges.append(edge)
|
state.out_edges.append(edge)
|
||||||
|
|
||||||
def get_label(state):
|
def get_label(state):
|
||||||
|
|
Loading…
Reference in New Issue