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

Submitted by Arnon Gilboa on Sept. 16, 2012, 8:50 a.m.

Details

Message ID 1347785415-14805-1-git-send-email-agilboa@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Arnon Gilboa Sept. 16, 2012, 8:50 a.m.
win7-only issue

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

Patch hide | download patch | download mbox

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 &&

Comments

On 09/16/2012 11:50 AM, Arnon Gilboa wrote:
> 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&&

Ack.
On 09/23/2012 04:51 PM, Uri Lublin wrote:
> On 09/16/2012 11:50 AM, Arnon Gilboa wrote:
>> 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&&
>
> Ack.
Ack series