Re: [PATCH spice-gtk 03/14] channel: add SPICE_DISABLE_CHANNELS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/10/2013 10:44 AM, 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..46caeef 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))
+        c->disable_channel_msg = TRUE;
+
      c->connection_id = spice_session_get_connection_id(c->session);
      spice_session_channel_new(c->session, channel);

@@ -2075,6 +2079,7 @@ static void spice_channel_iterate_write(SpiceChannel *channel)
  static void spice_channel_iterate_read(SpiceChannel *channel)
  {
      SpiceChannelPrivate *c = channel->priv;
+
      g_return_if_fail(c->state != SPICE_CHANNEL_STATE_MIGRATING);

      spice_channel_recv_msg(channel,
@@ -2771,6 +2776,8 @@ static void spice_channel_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg)
      spice_msg_handler handler;

      g_return_if_fail(type < klass->handlers->len);
+    if (type > 100 && channel->priv->disable_channel_msg)
please replace 100 with a define. (Yes, we should have 100 as the enum ending the basic messages in the protocol. But shame on us we don't...)
+        return;

      handler = g_array_index(klass->handlers, spice_msg_handler, type);
      g_return_if_fail(handler != NULL);


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]