[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 16/20] Only acknowledge the shutdown if type is known
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/liteagent/LiteAgent.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/liteagent/LiteAgent.cpp b/src/liteagent/LiteAgent.cpp index 9f6f56f..739acbb 100644 --- a/src/liteagent/LiteAgent.cpp +++ b/src/liteagent/LiteAgent.cpp @@ -309,8 +309,8 @@ void CLiteAgent::OnShutdown() // check shutdown type and enact shutdown std::string type; - m_dev->StoreRead("control/shutdown", type); - m_dev->StoreRemove("control/shutdown"); + if (!m_dev->StoreRead("control/shutdown", type)) + return; CLiteAgent::Log("OnShutdown(%s)\n", type.c_str()); @@ -326,6 +326,7 @@ void CLiteAgent::OnShutdown() m_dev->StoreWrite("control/shutdown-state", "failed"); CLiteAgent::Log("InitiateSystemShutdownEx failed %08x\n", GetLastError()); } + m_dev->StoreRemove("control/shutdown"); } else if (type == "reboot") { AcquireSystemPrivilege(SE_SHUTDOWN_NAME); @@ -338,6 +339,7 @@ void CLiteAgent::OnShutdown() m_dev->StoreWrite("control/shutdown-state", "failed"); CLiteAgent::Log("InitiateSystemShutdownEx failed %08x\n", GetLastError()); } + m_dev->StoreRemove("control/shutdown"); } else if (type == "hibernate") { AcquireSystemPrivilege(SE_SHUTDOWN_NAME); @@ -347,6 +349,7 @@ void CLiteAgent::OnShutdown() m_dev->StoreWrite("control/hibernation-state", "failed"); CLiteAgent::Log("SetSystemPowerState failed %08x\n", GetLastError()); } + m_dev->StoreRemove("control/shutdown"); } else if (type == "s3") { AcquireSystemPrivilege(SE_SHUTDOWN_NAME); @@ -356,6 +359,7 @@ void CLiteAgent::OnShutdown() m_dev->StoreWrite("control/s3-state", "failed"); CLiteAgent::Log("SetSuspendState failed %08x\n", GetLastError()); } + m_dev->StoreRemove("control/shutdown"); } } @@ -367,6 +371,11 @@ void CLiteAgent::OnSuspend() return; CLiteAgent::Log("OnSuspend(%ws)\n", m_dev->Path()); + if (m_ctxt_shutdown) + m_dev->StoreRemoveWatch(m_ctxt_shutdown); + m_ctxt_shutdown = NULL; + m_dev->StoreAddWatch("control/shutdown", m_shutdown, &m_ctxt_shutdown); + // advertise m_dev->StoreWrite("control/feature-shutdown", "1"); // set xen time -- 1.9.4.msysgit.1 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |