From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> Local caps are set during construction, no need to reset to the same caps on channel_reset(). This also solves calling spice_channel_reset_capabilities() without an associated session (after a channel disconnect). Also fix keeping CAP_AUTH_SASL on reset. Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> --- src/channel-display.c | 7 +++---- src/channel-main.c | 5 ++--- src/channel-playback.c | 5 ++--- src/channel-record.c | 5 ++--- src/spice-channel.c | 16 ---------------- src/spice-channel.h | 2 +- 6 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/channel-display.c b/src/channel-display.c index 2a1d9d1..079b5f7 100644 --- a/src/channel-display.c +++ b/src/channel-display.c @@ -105,7 +105,7 @@ static void clear_surfaces(SpiceChannel *channel, gboolean keep_primary); static void clear_streams(SpiceChannel *channel); static display_surface *find_surface(SpiceDisplayChannelPrivate *c, guint32 surface_id); static void spice_display_channel_reset(SpiceChannel *channel, gboolean migrating); -static void spice_display_channel_reset_capabilities(SpiceChannel *channel); +static void spice_display_channel_set_capabilities(SpiceChannel *channel); static void destroy_canvas(display_surface *surface); static void display_stream_destroy(gpointer st); static void display_session_mm_time_reset_cb(SpiceSession *session, gpointer data); @@ -269,7 +269,6 @@ static void spice_display_channel_class_init(SpiceDisplayChannelClass *klass) channel_class->channel_up = spice_display_channel_up; channel_class->channel_reset = spice_display_channel_reset; - channel_class->channel_reset_capabilities = spice_display_channel_reset_capabilities; g_object_class_install_property (gobject_class, PROP_HEIGHT, @@ -843,7 +842,7 @@ static SpiceImageSurfacesOps image_surfaces_ops = { .get = surfaces_get }; -static void spice_display_channel_reset_capabilities(SpiceChannel *channel) +static void spice_display_channel_set_capabilities(SpiceChannel *channel) { guint i; @@ -900,7 +899,7 @@ static void spice_display_channel_init(SpiceDisplayChannel *channel) } else { c->enable_adaptive_streaming = TRUE; } - spice_display_channel_reset_capabilities(SPICE_CHANNEL(channel)); + spice_display_channel_set_capabilities(SPICE_CHANNEL(channel)); } /* ------------------------------------------------------------------ */ diff --git a/src/channel-main.c b/src/channel-main.c index d902f37..f8be9ff 100644 --- a/src/channel-main.c +++ b/src/channel-main.c @@ -238,7 +238,7 @@ static gboolean test_agent_cap(SpiceMainChannel *channel, guint32 cap) return VD_AGENT_HAS_CAPABILITY(c->agent_caps, G_N_ELEMENTS(c->agent_caps), cap); } -static void spice_main_channel_reset_capabilties(SpiceChannel *channel) +static void spice_main_channel_set_capabilties(SpiceChannel *channel) { spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE); spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_NAME_AND_UUID); @@ -256,7 +256,7 @@ static void spice_main_channel_init(SpiceMainChannel *channel) c->flushing = g_hash_table_new(g_direct_hash, g_direct_equal); c->cancellable_volume_info = g_cancellable_new(); - spice_main_channel_reset_capabilties(SPICE_CHANNEL(channel)); + spice_main_channel_set_capabilties(SPICE_CHANNEL(channel)); c->requested_mouse_mode = SPICE_MOUSE_MODE_CLIENT; } @@ -464,7 +464,6 @@ static void spice_main_channel_class_init(SpiceMainChannelClass *klass) channel_class->handle_msg = spice_main_handle_msg; channel_class->iterate_write = spice_channel_iterate_write; channel_class->channel_reset = spice_main_channel_reset; - channel_class->channel_reset_capabilities = spice_main_channel_reset_capabilties; channel_class->channel_send_migration_handshake = spice_main_channel_send_migration_handshake; /** diff --git a/src/channel-playback.c b/src/channel-playback.c index 3dc1849..a00706f 100644 --- a/src/channel-playback.c +++ b/src/channel-playback.c @@ -87,7 +87,7 @@ static void channel_set_handlers(SpiceChannelClass *klass); #define SPICE_PLAYBACK_DEFAULT_LATENCY_MS 200 -static void spice_playback_channel_reset_capabilities(SpiceChannel *channel) +static void spice_playback_channel_set_capabilities(SpiceChannel *channel) { if (!g_getenv("SPICE_DISABLE_CELT")) if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1, SND_CODEC_ANY_FREQUENCY)) @@ -103,7 +103,7 @@ static void spice_playback_channel_init(SpicePlaybackChannel *channel) { channel->priv = spice_playback_channel_get_instance_private(channel); - spice_playback_channel_reset_capabilities(SPICE_CHANNEL(channel)); + spice_playback_channel_set_capabilities(SPICE_CHANNEL(channel)); } static void spice_playback_channel_finalize(GObject *obj) @@ -185,7 +185,6 @@ static void spice_playback_channel_class_init(SpicePlaybackChannelClass *klass) gobject_class->set_property = spice_playback_channel_set_property; channel_class->channel_reset = spice_playback_channel_reset; - channel_class->channel_reset_capabilities = spice_playback_channel_reset_capabilities; g_object_class_install_property (gobject_class, PROP_NCHANNELS, diff --git a/src/channel-record.c b/src/channel-record.c index ab0a239..b46ba45 100644 --- a/src/channel-record.c +++ b/src/channel-record.c @@ -83,7 +83,7 @@ static void channel_set_handlers(SpiceChannelClass *klass); /* ------------------------------------------------------------------ */ -static void spice_record_channel_reset_capabilities(SpiceChannel *channel) +static void spice_record_channel_set_capabilities(SpiceChannel *channel) { if (!g_getenv("SPICE_DISABLE_CELT")) if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1, SND_CODEC_ANY_FREQUENCY)) @@ -98,7 +98,7 @@ static void spice_record_channel_init(SpiceRecordChannel *channel) { channel->priv = spice_record_channel_get_instance_private(channel); - spice_record_channel_reset_capabilities(SPICE_CHANNEL(channel)); + spice_record_channel_set_capabilities(SPICE_CHANNEL(channel)); } static void spice_record_channel_finalize(GObject *obj) @@ -180,7 +180,6 @@ static void spice_record_channel_class_init(SpiceRecordChannelClass *klass) gobject_class->get_property = spice_record_channel_get_property; gobject_class->set_property = spice_record_channel_set_property; channel_class->channel_reset = channel_reset; - channel_class->channel_reset_capabilities = spice_record_channel_reset_capabilities; g_object_class_install_property (gobject_class, PROP_NCHANNELS, diff --git a/src/spice-channel.c b/src/spice-channel.c index cc089eb..61de177 100644 --- a/src/spice-channel.c +++ b/src/spice-channel.c @@ -51,7 +51,6 @@ static void spice_channel_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg); static void spice_channel_write_msg(SpiceChannel *channel, SpiceMsgOut *out); static void spice_channel_send_link(SpiceChannel *channel); static void channel_reset(SpiceChannel *channel, gboolean migrating); -static void spice_channel_reset_capabilities(SpiceChannel *channel); static void spice_channel_send_migration_handshake(SpiceChannel *channel); static gboolean channel_connect(SpiceChannel *channel, gboolean tls); @@ -2859,11 +2858,6 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating) g_array_set_size(c->remote_common_caps, 0); g_array_set_size(c->remote_caps, 0); - g_array_set_size(c->common_caps, 0); - /* 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_reset_capabilities(channel); if (c->state == SPICE_CHANNEL_STATE_SWITCHING) spice_session_set_migration_state(spice_channel_get_session(channel), @@ -3106,16 +3100,6 @@ static void spice_channel_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg) handler(channel, msg); } -static void spice_channel_reset_capabilities(SpiceChannel *channel) -{ - SpiceChannelPrivate *c = channel->priv; - g_array_set_size(c->caps, 0); - - if (SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities) { - SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities(channel); - } -} - static void spice_channel_send_migration_handshake(SpiceChannel *channel) { SpiceChannelPrivate *c = channel->priv; diff --git a/src/spice-channel.h b/src/spice-channel.h index f79ec49..f068be1 100644 --- a/src/spice-channel.h +++ b/src/spice-channel.h @@ -109,7 +109,7 @@ struct _SpiceChannelClass /* virtual method, any context */ gpointer deprecated; void (*channel_reset)(SpiceChannel *channel, gboolean migrating); - void (*channel_reset_capabilities)(SpiceChannel *channel); + gpointer deprecated2; /*< private >*/ /* virtual methods, coroutine context */ -- 2.20.1.2.gb21ebb671b _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel