[Spice-devel] [PATCH 06/18] worker: move display_channel_wait_for_migrate_data

Fabiano Fidêncio fabiano at fidencio.org
Thu Nov 19 00:08:40 PST 2015


On Wed, Nov 18, 2015 at 5:17 PM, Frediano Ziglio <fziglio at redhat.com> wrote:
> From: Marc-André Lureau <marcandre.lureau at gmail.com>
>
> ---
>  server/display-channel.c | 31 +++++++++++++++++++++++++++++++
>  server/display-channel.h |  1 +
>  server/red_worker.c      | 31 -------------------------------
>  3 files changed, 32 insertions(+), 31 deletions(-)
>
> diff --git a/server/display-channel.c b/server/display-channel.c
> index c671571..1702bd6 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -807,3 +807,34 @@ int display_channel_add_drawable(DisplayChannel *display, Drawable *drawable)
>
>      return ret;
>  }
> +
> +int display_channel_wait_for_migrate_data(DisplayChannel *display)
> +{
> +    uint64_t end_time = red_get_monotonic_time() + DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT;
> +    RedChannel *channel = &display->common.base;
> +    RedChannelClient *rcc;
> +
> +    spice_debug(NULL);
> +    spice_assert(channel->clients_num == 1);
> +
> +    rcc = SPICE_CONTAINEROF(ring_get_head(&channel->clients), RedChannelClient, channel_link);
> +    spice_assert(red_channel_client_waits_for_migrate_data(rcc));
> +
> +    for (;;) {
> +        red_channel_client_receive(rcc);
> +        if (!red_channel_client_is_connected(rcc)) {
> +            break;
> +        }
> +
> +        if (!red_channel_client_waits_for_migrate_data(rcc)) {
> +            return TRUE;
> +        }
> +        if (red_get_monotonic_time() > end_time) {
> +            spice_warning("timeout");
> +            red_channel_client_disconnect(rcc);
> +            break;
> +        }
> +        usleep(DISPLAY_CLIENT_RETRY_INTERVAL);
> +    }
> +    return FALSE;
> +}
> diff --git a/server/display-channel.h b/server/display-channel.h
> index ae55114..5f5bc51 100644
> --- a/server/display-channel.h
> +++ b/server/display-channel.h
> @@ -267,6 +267,7 @@ int                        display_channel_add_drawable              (DisplayCha
>                                                                        Drawable *drawable);
>  void                       display_channel_current_flush             (DisplayChannel *display,
>                                                                        int surface_id);
> +int                        display_channel_wait_for_migrate_data     (DisplayChannel *display);
>
>  static inline int is_equal_path(SpicePath *path1, SpicePath *path2)
>  {
> diff --git a/server/red_worker.c b/server/red_worker.c
> index a7baf0e..f7ba2d8 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -6916,37 +6916,6 @@ static void handle_dev_stop(void *opaque, void *payload)
>      }
>  }
>
> -static int display_channel_wait_for_migrate_data(DisplayChannel *display)
> -{
> -    uint64_t end_time = red_get_monotonic_time() + DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT;
> -    RedChannel *channel = &display->common.base;
> -    RedChannelClient *rcc;
> -
> -    spice_debug(NULL);
> -    spice_assert(channel->clients_num == 1);
> -
> -    rcc = SPICE_CONTAINEROF(ring_get_head(&channel->clients), RedChannelClient, channel_link);
> -    spice_assert(red_channel_client_waits_for_migrate_data(rcc));
> -
> -    for (;;) {
> -        red_channel_client_receive(rcc);
> -        if (!red_channel_client_is_connected(rcc)) {
> -            break;
> -        }
> -
> -        if (!red_channel_client_waits_for_migrate_data(rcc)) {
> -            return TRUE;
> -        }
> -        if (red_get_monotonic_time() > end_time) {
> -            spice_warning("timeout");
> -            red_channel_client_disconnect(rcc);
> -            break;
> -        }
> -        usleep(DISPLAY_CLIENT_RETRY_INTERVAL);
> -    }
> -    return FALSE;
> -}
> -
>  static void handle_dev_start(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
> --
> 2.4.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Patch seems fine, ACK!

-- 
Fabiano Fidêncio


More information about the Spice-devel mailing list