[Spice-devel] [PATCH spice-gtk 2/9] channel: reset tls state when client calls connect
Marc-André Lureau
marcandre.lureau at redhat.com
Tue Jan 13 08:38:21 PST 2015
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
More information about the Spice-devel
mailing list