[virt-tools-list] [PATCH 2/2] Ensure auto-conf is only done once

Marc-André Lureau mlureau at redhat.com
Fri Nov 8 22:15:04 UTC 2013



----- Original Message -----
> Auto-conf should only happen at startup. It is triggered from several places
> due
> to the somewhat unreliable ordering of events, but that doesn't mean we want
> to
> run it several times. This patch ensures that we only do it once.
> ---
>  src/virt-viewer-session-spice.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/virt-viewer-session-spice.c
> b/src/virt-viewer-session-spice.c
> index 41467cf..68cf984 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -55,6 +55,7 @@ struct _VirtViewerSessionSpicePrivate {
>      int usbredir_channel_count;
>      gboolean has_sw_smartcard_reader;
>      guint pass_try;
> +    gboolean did_auto_conf;
>  };
>  
>  #define VIRT_VIEWER_SESSION_SPICE_GET_PRIVATE(o)
>  (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_SESSION_SPICE,
>  VirtViewerSessionSpicePrivate))
> @@ -726,6 +727,13 @@
> virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
>      gint i;
>      gsize ndisplays = 0;
>  
> +    /* only do auto-conf once at startup. Avoid repeating auto-conf later
> due to
> +     * agent disconnection/re-connection, etc */
> +    if (self->priv->did_auto_conf) {
> +        DEBUG_LOG("Already did auto-conf, skipping");
> +        return FALSE;
> +    }
> +

ack

>      app = virt_viewer_session_get_app(VIRT_VIEWER_SESSION(self));
>      g_return_val_if_fail(VIRT_VIEWER_IS_APP(app), TRUE);
>  
> @@ -770,6 +778,7 @@
> virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
>      }
>  
>      spice_main_send_monitor_config(cmain);
> +    self->priv->did_auto_conf = TRUE;
>      return TRUE;
>  }
>  
> --
> 1.8.3.1
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
> 




More information about the virt-tools-list mailing list