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

Marc-André Lureau marcandre.lureau at gmail.com
Thu Sep 12 09:11:53 PDT 2013


On Thu, Sep 12, 2013 at 6:01 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> 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 ':' ?

simplicity, iirc, even glib does that.

> Patch looks good otherwise.
>
> Christophe



-- 
Marc-André Lureau


More information about the Spice-devel mailing list