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 ...@@ -700,7 +700,7 @@ GCFEvent::TResult StationControl::operational_state(GCFEvent& event, GCFPortInte
// In the claim state station-wide changes are activated. // In the claim state station-wide changes are activated.
if (event.signal == CONTROL_CLAIM) { if (event.signal == CONTROL_CLAIM) {
if (itsClaimSequence == 0) { if (itsStartingObs != theObs) {
itsStartingObs = theObs; itsStartingObs = theObs;
TRAN(StationControl::startObservation_state); TRAN(StationControl::startObservation_state);
queueTaskEvent(event, port); queueTaskEvent(event, port);
...@@ -788,6 +788,12 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor ...@@ -788,6 +788,12 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor
*/ */
switch (event.signal) { switch (event.signal) {
case F_ENTRY: {
itsClaimSequence = 1;
itsClaimTimerPort->setTimer(0.0);
}
break;
case CONTROL_CLAIM: { case CONTROL_CLAIM: {
// defer the setup to the timer eventa // defer the setup to the timer eventa
// NOTE: StationControl can receive multiple CLAIM requests. Example: // NOTE: StationControl can receive multiple CLAIM requests. Example:
...@@ -795,10 +801,19 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor ...@@ -795,10 +801,19 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor
// * Station receives PREPARE (due to state sync errors?) // * Station receives PREPARE (due to state sync errors?)
// * Station will replay PREPARE -> CLAIM // * Station will replay PREPARE -> CLAIM
// So we ONLY start the ClaimTimer if the ClaimSequence was not yet started // So we ONLY start the ClaimTimer if the ClaimSequence was not yet started
if (itsClaimSequence == 0) { CONTROLCommonEvent ObsEvent(event); // we just need the name
itsClaimSequence++; uint16 instanceNr = getInstanceNr(ObsEvent.cntlrName);
itsClaimTimerPort->setTimer(0.0); 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; break;
...@@ -952,7 +967,6 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor ...@@ -952,7 +967,6 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor
} }
break; break;
case F_ENTRY:
case F_EXIT: case F_EXIT:
break; 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