[Spice-devel] [PATCH spice-gtk 04/14] channel: add SPICE_DISABLE_CHANNELS

Christophe Fergeau cfergeau at redhat.com
Thu Sep 12 09:01:39 PDT 2013


On Thu, Sep 12, 2013 at 02:09:12PM +0200, Marc-André Lureau wrote:
> Allow to disable selectively channels, mainly used for testing,
> ex: SPICE_DISABLE_CHANNELS=display spicy-stats -p 12345
> ---
>  gtk/spice-channel-priv.h | 2 ++
>  gtk/spice-channel.c      | 7 +++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h
> index 92c9315..1f29c23 100644
> --- a/gtk/spice-channel-priv.h
> +++ b/gtk/spice-channel-priv.h
> @@ -134,6 +134,8 @@ struct _SpiceChannelPrivate {
>      gsize                       total_read_bytes;
>      uint64_t                    last_message_serial;
>      GSList                      *flushing;
> +
> +    gboolean                    disable_channel_msg;
>  };
>  
>  SpiceMsgIn *spice_msg_in_new(SpiceChannel *channel);
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index a0d9c15..55c8325 100644
> --- a/gtk/spice-channel.c
> +++ b/gtk/spice-channel.c
> @@ -126,6 +126,10 @@ static void spice_channel_constructed(GObject *gobject)
>               desc ? desc : "unknown", c->channel_type, c->channel_id);
>      CHANNEL_DEBUG(channel, "%s", __FUNCTION__);
>  
> +    const char *disabled  = g_getenv("SPICE_DISABLE_CHANNELS");
> +    if (disabled && strstr(disabled, desc))

Is there a reason for doing a strstr rather than iterating over the string
split on ':' ?

Patch looks good otherwise.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130912/7fa521c0/attachment.pgp>


More information about the Spice-devel mailing list