mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-11-25 21:21:37 +00:00
fix(fsm): refuse all transitions in the Error state
- The Error state is a terminate state: the state machine ignores all events in it and calls no action, so ChangeState() returned the result of the previous transition (ErrorFound: true) - Return false for each transition in the Error state, except for ErrorFound: the device is already in the Error state, so callers such as ChangeStateOrThrow(ErrorFound) in Device::RunWrapper() or in user code do not throw - Enable StateMachine.RefusesTransitionsInError - Update the documentation pages that described the defect, and the source line links into the changed files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -259,6 +259,12 @@ try {
|
||||
auto fsm = static_pointer_cast<FairMQFSM>(fFsm);
|
||||
lock_guard<mutex> lock(fsm->fStateMtx);
|
||||
if (!static_cast<bool>(fsm->fNewStatePending) || transition == Transition::ErrorFound) {
|
||||
// The Error state is a terminate state: the state machine ignores all events in it and
|
||||
// calls no action, so fLastTransitionResult would keep the result of ErrorFound.
|
||||
// ErrorFound has nothing left to do; refuse all other transitions.
|
||||
if (fsm->is_flag_active<boost::msm::TerminateFlag>()) {
|
||||
return transition == Transition::ErrorFound;
|
||||
}
|
||||
switch (transition) {
|
||||
case Transition::Auto:
|
||||
fsm->process_event(AUTO_E());
|
||||
|
||||
Reference in New Issue
Block a user