Re: [PATCH phodav 04/13] spice: quit service quickly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 23, 2019 at 10:37 AM Jakub Janků <jjanku@xxxxxxxxxx> wrote:
>
> We shouldn't wait for 1 second if the service is supposed to stop.
>
> Signed-off-by: Jakub Janků <jjanku@xxxxxxxxxx>

ack

> ---
>  spice/spice-webdavd.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
> index cdfa73d..6ad63c5 100644
> --- a/spice/spice-webdavd.c
> +++ b/spice/spice-webdavd.c
> @@ -923,11 +923,15 @@ map_drive_cb(GTask *task,
>
>  #endif
>
> -static void
> +/* returns FALSE if the service should quit */
> +static gboolean
>  run_service (ServiceData *service_data)
>  {
>    g_debug ("Run service");
>
> +  if (quit_service)
> +    return FALSE;
> +
>  #ifdef G_OS_WIN32
>    MapDriveData map_drive_data;
>    map_drive_data.cancel_map = g_cancellable_new ();
> @@ -1003,6 +1007,7 @@ run_service (ServiceData *service_data)
>  #else
>    close (port_fd);
>  #endif
> +  return !quit_service;
>  }
>
>  #ifdef G_OS_WIN32
> @@ -1064,9 +1069,8 @@ service_main (DWORD argc, TCHAR *argv[])
>    service_status.dwWaitHint = 0;
>    SetServiceStatus (service_status_handle, &service_status);
>
> -  while (!quit_service) {
> -      run_service (&service_data);
> -      g_usleep (G_USEC_PER_SEC);
> +  while (run_service(&service_data)) {
> +    g_usleep(G_USEC_PER_SEC);
>    }
>
>    service_status.dwCurrentState = SERVICE_STOPPED;
> @@ -1154,8 +1158,7 @@ main (int argc, char *argv[])
>          }
>      } else
>  #endif
> -  while (!quit_service) {
> -    run_service (&service_data);
> +  while (run_service(&service_data)) {
>      g_usleep (G_USEC_PER_SEC);
>    }
>
> --
> 2.21.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]