diff options
Diffstat (limited to 'host-interface.cpp')
-rw-r--r-- | host-interface.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/host-interface.cpp b/host-interface.cpp index aa32ff0..160c127 100644 --- a/host-interface.cpp +++ b/host-interface.cpp @@ -16,15 +16,14 @@ using namespace phosphor::logging; // When you see base:: you know we're referencing our base class namespace base = sdbusplus::xyz::openbmc_project::Control::server; -void Host::execute(base::Host::Command command) -{ - log<level::INFO>("Pushing cmd on to queue", - entry("CONTROL_HOST_CMD=%s", - convertForMessage(command))); - this->workQueue.push(command); +// TODO - Add timeout function? +// - If host does not respond to SMS, need to signal a failure +// - Flush queue on power off? - Timeout would do this for us for free +// - Ignore requests when host state not running? - Timeout handles too - // If this was the only entry then send the SMS attention - if(this->workQueue.size() == 1) +void Host::checkQueue() +{ + if (this->workQueue.size() >= 1) { log<level::INFO>("Asserting SMS Attention"); @@ -46,6 +45,26 @@ void Host::execute(base::Host::Command command) } log<level::INFO>("SMS Attention asserted"); } +} + +void Host::execute(base::Host::Command command) +{ + log<level::INFO>("Pushing cmd on to queue", + entry("CONTROL_HOST_CMD=%s", + convertForMessage(command))); + + this->workQueue.push(command); + + // Alert host if this is only command in queue otherwise host will + // be notified of next message after processing the current one + if (this->workQueue.size() == 1) + { + this->checkQueue(); + } + else + { + log<level::INFO>("Command in process, no attention"); + } return; } |