[Spice-devel] fix client disconnect

Submitted by Peter Hatina on May 3, 2012, 8:25 a.m.

Details

Message ID 1336033531-21689-1-git-send-email-phatina@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Peter Hatina May 3, 2012, 8:25 a.m.
Hi,

can you, please, have a look at this? Due to script structure
(/usr/libexec/spice-xpi-client), we need to signal a process group
to correctly tear down spicec/remote-viewer. This should fix
rhbz#810583

Thanks,

-Peter

---
 SpiceXPI/src/plugin/plugin.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index 9686ca5..349b483 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -682,6 +682,8 @@  void nsPluginInstance::Connect()
     m_pid_controller = fork();
     if (m_pid_controller == 0)
     {
+        setpgrp();
+
         char *spice_xpi_client_args[] = {
             const_cast<char*>("/usr/libexec/spice-xpi-client"),
             NULL
@@ -808,7 +810,7 @@  void nsPluginInstance::Disconnect()
 {
     LOG_INFO("Disconnecting");
     if (m_pid_controller > 0)
-        kill(m_pid_controller, SIGTERM);
+        kill(-m_pid_controller, SIGTERM);
     if (m_pid_usbrdrctrl > 0)
         kill(m_pid_usbrdrctrl, SIGTERM);
 }

Comments

Hi,

On 05/03/2012 10:25 AM, Peter Hatina wrote:
> Hi,
>
> can you, please, have a look at this? Due to script structure
> (/usr/libexec/spice-xpi-client), we need to signal a process group
> to correctly tear down spicec/remote-viewer. This should fix
> rhbz#810583

Ah, I see this is caused by the piping to logger to log any
output, which causes there to be multiple processes.

ACK.

Regards,

Hans



>
> Thanks,
>
> -Peter
>
> ---
>   SpiceXPI/src/plugin/plugin.cpp |    4 +++-
>   1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
> index 9686ca5..349b483 100644
> --- a/SpiceXPI/src/plugin/plugin.cpp
> +++ b/SpiceXPI/src/plugin/plugin.cpp
> @@ -682,6 +682,8 @@ void nsPluginInstance::Connect()
>       m_pid_controller = fork();
>       if (m_pid_controller == 0)
>       {
> +        setpgrp();
> +
>           char *spice_xpi_client_args[] = {
>               const_cast<char*>("/usr/libexec/spice-xpi-client"),
>               NULL
> @@ -808,7 +810,7 @@ void nsPluginInstance::Disconnect()
>   {
>       LOG_INFO("Disconnecting");
>       if (m_pid_controller>  0)
> -        kill(m_pid_controller, SIGTERM);
> +        kill(-m_pid_controller, SIGTERM);
>       if (m_pid_usbrdrctrl>  0)
>           kill(m_pid_usbrdrctrl, SIGTERM);
>   }