[Spice-devel] [PATCH 3/3] vdservice: restart vdagent if killed manually

Arnon Gilboa agilboa at redhat.com
Mon Sep 10 01:00:56 PDT 2012


win7-only issue

rhbz#845222
---
 vdservice/vdservice.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index 696f3da..b48cbeb 100644
--- a/vdservice/vdservice.cpp
+++ b/vdservice/vdservice.cpp
@@ -590,6 +590,16 @@ bool VDService::execute()
                         restart_agent(false);
                     } else if (_system_version == SYS_VER_WIN_7_CLASS) {
                         kill_agent();
+                        // Assume agent was killed due to console disconnect, and wait for agent
+                        // normal restart due to console connect. If the agent is not alive yet,
+                        // it was killed manually (or crashed), so let's restart it.
+                        if (WaitForSingleObject(_control_event, VD_AGENT_RESTART_INTERVAL) ==
+                                WAIT_OBJECT_0) {
+                            handle_control_event();
+                        }
+                        if (_running && !_agent_alive) {
+                            restart_agent(false);
+                        }
                     }
                 } else {
                     if (wait_ret >= WAIT_OBJECT_0 + _events_vdi_port_base &&
-- 
1.7.4.1



More information about the Spice-devel mailing list