Skip to content
Snippets Groups Projects
Commit 4f59e83f authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #6883: Allow multiple observations to reach CLAIM phase

parent b3dc3731
No related branches found
No related tags found
No related merge requests found
......@@ -700,7 +700,7 @@ GCFEvent::TResult StationControl::operational_state(GCFEvent& event, GCFPortInte
// In the claim state station-wide changes are activated.
if (event.signal == CONTROL_CLAIM) {
if (itsClaimSequence == 0) {
if (itsStartingObs != theObs) {
itsStartingObs = theObs;
TRAN(StationControl::startObservation_state);
queueTaskEvent(event, port);
......@@ -788,6 +788,12 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor
*/
switch (event.signal) {
case F_ENTRY: {
itsClaimSequence = 1;
itsClaimTimerPort->setTimer(0.0);
}
break;
case CONTROL_CLAIM: {
// defer the setup to the timer eventa
// NOTE: StationControl can receive multiple CLAIM requests. Example:
......@@ -795,10 +801,19 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor
// * Station receives PREPARE (due to state sync errors?)
// * Station will replay PREPARE -> CLAIM
// So we ONLY start the ClaimTimer if the ClaimSequence was not yet started
if (itsClaimSequence == 0) {
itsClaimSequence++;
itsClaimTimerPort->setTimer(0.0);
}
CONTROLCommonEvent ObsEvent(event); // we just need the name
uint16 instanceNr = getInstanceNr(ObsEvent.cntlrName);
OTDBtreeIDType treeID = getObservationNr(ObsEvent.cntlrName);
string cntlrName = controllerName(CNTLRTYPE_STATIONCTRL,
instanceNr, treeID);
CTState CTS;
ObsIter theObs = itsObsMap.find(cntlrName);
if (theObs != itsStartingObs) {
// CLAIM is for a different observation
LOG_DEBUG_STR("Postponing event " << eventName(event) << " till operational state");
return (GCFEvent::NEXT_STATE);
}
}
break;
......@@ -952,7 +967,6 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor
}
break;
case F_ENTRY:
case F_EXIT:
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment