mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2025-11-02 11:47:47 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -130,6 +130,16 @@ namespace OpenWifi {
|
|||||||
fmt::format("Outstanding-requests {}", OutStandingRequests_.size()));
|
fmt::format("Outstanding-requests {}", OutStandingRequests_.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CommandManager::IsCommandRunning(const std::string &C) {
|
||||||
|
std::shared_lock Lock(LocalMutex_);
|
||||||
|
for (const auto &request : OutStandingRequests_) {
|
||||||
|
if (request.second.UUID == C) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CommandManager::onCommandRunnerTimer([[maybe_unused]] Poco::Timer &timer) {
|
void CommandManager::onCommandRunnerTimer([[maybe_unused]] Poco::Timer &timer) {
|
||||||
Utils::SetThreadName("cmd:schdlr");
|
Utils::SetThreadName("cmd:schdlr");
|
||||||
Poco::Logger &MyLogger = Poco::Logger::get("CMD-MGR-SCHEDULER");
|
Poco::Logger &MyLogger = Poco::Logger::get("CMD-MGR-SCHEDULER");
|
||||||
@@ -153,14 +163,10 @@ namespace OpenWifi {
|
|||||||
MyLogger, fmt::format("{}: Serial={} Command={} Starting processing.",
|
MyLogger, fmt::format("{}: Serial={} Command={} Starting processing.",
|
||||||
Cmd.UUID, Cmd.SerialNumber, Cmd.Command));
|
Cmd.UUID, Cmd.SerialNumber, Cmd.Command));
|
||||||
try {
|
try {
|
||||||
{
|
|
||||||
std::shared_lock Lock(LocalMutex_);
|
// Skip an already running command
|
||||||
for (const auto &request : OutStandingRequests_) {
|
if(IsCommandRunning(Cmd.UUID))
|
||||||
if (request.second.UUID == Cmd.UUID) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto now = OpenWifi::Now();
|
auto now = OpenWifi::Now();
|
||||||
// 2 hour timeout for commands
|
// 2 hour timeout for commands
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ namespace OpenWifi {
|
|||||||
false, Sent );
|
false, Sent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsCommandRunning(const std::string &C);
|
||||||
|
|
||||||
void run() override;
|
void run() override;
|
||||||
|
|
||||||
static auto instance() {
|
static auto instance() {
|
||||||
|
|||||||
Reference in New Issue
Block a user