[virt-tools-list] [virt-viewer][PATCH 4/4 v2] Replace priv->withEvents usage for priv->domain_event

Christophe Fergeau cfergeau at redhat.com
Thu Nov 20 09:57:46 UTC 2014


On Wed, Nov 19, 2014 at 04:05:47PM +0100, Fabiano Fidêncio wrote:
> Once we have priv->domain_event, we don't need priv->withEvents anymore
> ---
>  src/virt-viewer.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index 2c19057..3c45728 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -55,7 +55,6 @@ struct _VirtViewerPrivate {
>      virConnectPtr conn;
>      virDomainPtr dom;
>      char *domkey;
> -    gboolean withEvents;
>      gboolean waitvm;
>      gboolean reconnect;
>      gboolean auth_cancelled;
> @@ -128,7 +127,7 @@ virt_viewer_deactivated(VirtViewerApp *app, gboolean connect_error)
>      }
>  
>      if (priv->reconnect) {
> -        if (!priv->withEvents) {
> +        if (priv->domain_event < 0) {
>              g_debug("No domain events, falling back to polling");
>              virt_viewer_app_start_reconnect_poll(app);
>          }
> @@ -531,7 +530,7 @@ virt_viewer_dispose (GObject *object)
>      VirtViewerPrivate *priv = self->priv;
>  
>      if (priv->conn) {
> -        if (priv->withEvents) {
> +        if (priv->domain_event >= 0) {
>              virConnectDomainEventDeregisterAny(priv->conn,
>                                                 priv->domain_event);
>              priv->domain_event = -1;
> @@ -833,12 +832,7 @@ virt_viewer_connect(VirtViewerApp *app)
>                                                            VIR_DOMAIN_EVENT_CALLBACK(virt_viewer_domain_event),
>                                                            self,
>                                                            NULL);
> -    if (priv->domain_event < 0)
> -        priv->withEvents = FALSE;
> -    else
> -        priv->withEvents = TRUE;
> -
> -    if (!priv->withEvents &&
> +    if (priv->domain_event < 0 &&
>          !virt_viewer_app_is_active(app)) {
>          g_debug("No domain events, falling back to polling");
>          virt_viewer_app_start_reconnect_poll(app);

You need that too:

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index dc16b3f..127681a 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -113,6 +113,7 @@ static void
 virt_viewer_init(VirtViewer *self)
 {
     self->priv = GET_PRIVATE(self);
+    self->priv->domain_event = -1;
 }

 static void


Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20141120/532f6226/attachment.sig>


More information about the virt-tools-list mailing list