]> xenbits.xensource.com Git - people/pauldu/xeniface.git/commitdiff
xenagent: use new Start/StopShutdownWatch() functions in resume from suspend
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 1 Aug 2016 15:23:11 +0000 (16:23 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 1 Aug 2016 15:23:11 +0000 (16:23 +0100)
The patch removes some code duplication by using the StopShutdownwatch()
and StartShutdownWatch() functions on resume from suspend rather than
duplicating their content.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenagent/service.cpp

index d105bc439846dde81d47e14b6f298a98c72e500a..170c2dd5aea71291bb3a65fdc82d8862c327b83c 100644 (file)
@@ -552,17 +552,8 @@ void CXenAgent::OnSuspend()
     EventLog(EVENT_XENUSER_UNSUSPENDED);
 
     // recreate shutdown watch, as suspending deactivated the watch
-    if (m_ctxt_shutdown)
-        m_device->StoreRemoveWatch(m_ctxt_shutdown);
-    m_ctxt_shutdown = NULL;
-
-    m_device->StoreAddWatch("control/shutdown", m_evt_shutdown, &m_ctxt_shutdown);
-    m_device->StoreWrite("control/feature-poweroff", "1");
-    m_device->StoreWrite("control/feature-reboot", "1");
-    m_device->StoreWrite("control/feature-s3", "1");
-    m_device->StoreWrite("control/feature-s4", "1");
-
-
+    StopShutdownWatch();
+    StartShutdownWatch();
     SetXenTime();
 }