[Spice-devel] [PATCH spice-gtk 2/9] channel: reset tls state when client calls connect

Christophe Fergeau cfergeau at redhat.com
Mon Jan 26 09:24:44 PST 2015


ACK.

Are there client applications calling spice_channel_connect() after the
channel has been reset/disconnected?

Christophe

On Tue, Jan 13, 2015 at 05:38:21PM +0100, Marc-André Lureau wrote:
> The channel TLS state is kept during disconnection and reset, for
> automatic reconnection and migrations reasons. However, when
> spice_channel_connect() is called by client, it should first try
> non-TLS connection.
> ---
>  gtk/spice-channel.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index 2f0ae1a..7c7cbe1 100644
> --- a/gtk/spice-channel.c
> +++ b/gtk/spice-channel.c
> @@ -57,6 +57,7 @@ static void channel_disconnect(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);
>  
>  /**
>   * SECTION:spice-channel
> @@ -2491,7 +2492,7 @@ cleanup:
>  
>      if (c->event == SPICE_CHANNEL_NONE &&
>          c->state == SPICE_CHANNEL_STATE_RECONNECTING) {
> -        spice_channel_connect(channel);
> +        channel_connect(channel, c->tls);
>          g_object_unref(channel);
>      } else
>          g_idle_add(spice_channel_delayed_unref, data);
> @@ -2523,7 +2524,7 @@ static gboolean connect_delayed(gpointer data)
>  }
>  
>  /* any context */
> -static gboolean channel_connect(SpiceChannel *channel)
> +static gboolean channel_connect(SpiceChannel *channel, gboolean tls)
>  {
>      SpiceChannelPrivate *c = channel->priv;
>  
> @@ -2536,6 +2537,7 @@ static gboolean channel_connect(SpiceChannel *channel)
>      }
>  
>      c->state = SPICE_CHANNEL_STATE_CONNECTING;
> +    c->tls = tls;
>  
>      if (spice_session_get_client_provided_socket(c->session)) {
>          if (c->fd == -1) {
> @@ -2577,7 +2579,7 @@ gboolean spice_channel_connect(SpiceChannel *channel)
>  
>      g_return_val_if_fail(channel->priv->fd == -1, FALSE);
>  
> -    return channel_connect(channel);
> +    return channel_connect(channel, FALSE);
>  }
>  
>  /**
> @@ -2610,7 +2612,7 @@ gboolean spice_channel_open_fd(SpiceChannel *channel, int fd)
>  
>      c->fd = fd;
>  
> -    return channel_connect(channel);
> +    return channel_connect(channel, FALSE);
>  }
>  
>  /* system or coroutine context */
> @@ -2709,7 +2711,7 @@ static void channel_disconnect(SpiceChannel *channel)
>      g_return_if_fail(SPICE_IS_CHANNEL(channel));
>  
>      if (c->state == SPICE_CHANNEL_STATE_SWITCHING) {
> -        spice_channel_connect(channel);
> +        channel_connect(channel, c->tls);
>          spice_session_set_migration_state(spice_channel_get_session(channel),
>                                            SPICE_SESSION_MIGRATION_NONE);
>      }
> -- 
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150126/c19b99a9/attachment-0001.sig>


More information about the Spice-devel mailing list