[PATCHv2 02/10] channel: reset tls state when client calls connect

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

 



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 bd14bce..90ba631 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -55,6 +55,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
@@ -2429,7 +2430,7 @@ cleanup:
 
     if (c->state == SPICE_CHANNEL_STATE_RECONNECTING) {
         g_warn_if_fail(c->event == SPICE_CHANNEL_NONE);
-        spice_channel_connect(channel);
+        channel_connect(channel, c->tls);
         g_object_unref(channel);
     } else
         g_idle_add(spice_channel_delayed_unref, data);
@@ -2461,7 +2462,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;
 
@@ -2474,6 +2475,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) {
@@ -2515,7 +2517,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);
 }
 
 /**
@@ -2548,7 +2550,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 */
@@ -2647,7 +2649,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@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]