[Spice-devel] [PATCH spice-gtk 1/5] Fix not setting channel specific capabilities upon channel reset
Yonit Halperin
yhalperi at redhat.com
Thu May 17 02:20:17 PDT 2012
Related: rhbz#821795
The capabilities have been zeroed after channel reset, which have lead to
publish the wrong caps when both port and tls-port are given, and the
channels are secured (first attempt to connect the channel with "port"
has failed; the channel got reset, and then reconnected with "tls-port"
and bad caps). Specifically, the bug causes semi-seamless migration not
to work when part of the channels are secured.
---
gtk/spice-channel.c | 16 +++++++++++++++-
gtk/spice-channel.h | 1 +
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 574867c..9d6325d 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -48,6 +48,7 @@ static void spice_channel_write_msg(SpiceChannel *channel, SpiceMsgOut *out);
static void spice_channel_send_link(SpiceChannel *channel);
static void channel_disconnect(SpiceChannel *channel);
static void channel_reset(SpiceChannel *channel, gboolean migrating);
+static void spice_channel_reset_capabilities(SpiceChannel *channel);
/**
* SECTION:spice-channel
@@ -258,6 +259,7 @@ static void spice_channel_class_init(SpiceChannelClass *klass)
klass->iterate_read = spice_channel_iterate_read;
klass->channel_disconnect = channel_disconnect;
klass->channel_reset = channel_reset;
+ klass->channel_reset_capabilities = spice_channel_reset_capabilities;
gobject_class->constructed = spice_channel_constructed;
gobject_class->dispose = spice_channel_dispose;
@@ -1147,7 +1149,11 @@ static void spice_channel_send_link(SpiceChannel *channel)
*(uint32_t *)p = g_array_index(c->caps, uint32_t, i);
p += sizeof(uint32_t);
}
-
+ SPICE_DEBUG("channel type %d id %d num common caps %d num caps %d",
+ c->link_msg.channel_type,
+ c->link_msg.channel_id,
+ c->link_msg.num_common_caps,
+ c->link_msg.num_channel_caps);
spice_channel_write(channel, buffer, p - buffer);
free(buffer);
}
@@ -2394,6 +2400,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
/* Restore our default capabilities in case the channel gets re-used */
spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION);
spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_MINI_HEADER);
+ SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities(channel);
}
/* system or coroutine context */
@@ -2632,3 +2639,10 @@ static void spice_channel_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg)
base_handlers[type](channel, msg);
}
+
+static void spice_channel_reset_capabilities(SpiceChannel *channel)
+{
+
+ SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
+ g_array_set_size(c->caps, 0);
+}
diff --git a/gtk/spice-channel.h b/gtk/spice-channel.h
index 2a8e7e7..f722c99 100644
--- a/gtk/spice-channel.h
+++ b/gtk/spice-channel.h
@@ -78,6 +78,7 @@ struct _SpiceChannelClass
void (*channel_up)(SpiceChannel *channel);
void (*iterate_write)(SpiceChannel *channel);
void (*iterate_read)(SpiceChannel *channel);
+ void (*channel_reset_capabilities)(SpiceChannel *channel);
/*< public >*/
/* signals, main context */
--
1.7.7.6
More information about the Spice-devel
mailing list