Fixing stats reset at sim startup.

This commit is contained in:
stephb9959
2021-11-04 10:28:10 -07:00
parent 0d6fb77e10
commit 9fbdbbd1bb
9 changed files with 69 additions and 128 deletions

View File

@@ -41,6 +41,17 @@ namespace OpenWifi {
Poco::Thread::trySleep(2000);
if(!Running_)
break;
if(SimStats()->GetState()!="running") {
continue;
}
uint64_t Now = std::time(nullptr);
if( (Now - SimStats()->GetStartTime()) > CurrentSim_.simulationLength ) {
std::string Error;
StopSim( SimStats()->Id(), Error );
}
}
}
@@ -142,6 +153,12 @@ namespace OpenWifi {
SimRunning_ = false;
SimStats()->SetState("stopped");
SimStats()->EndSim();
OWLSObjects::SimulationStatus S;
SimStats()->GetCurrent(S);
StorageService()->SimulationResultsDB().CreateRecord(S);
return true;
}