[Spice-devel] [PATCH spice-gtk v2 05/19] migration: fail with client provided fd

Marc-André Lureau marcandre.lureau at redhat.com
Thu Nov 13 15:32:28 PST 2014


Currently the fd request is done on the migration session, which is not
connected with the client session, so the client has no way to provide
fd for the migration. And the original and migration session ends up
stuck. Failing early seems the best for now.
---
 TODO                |  1 +
 gtk/spice-channel.c |  4 ++++
 gtk/spice-session.c | 18 +++++++++++++-----
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/TODO b/TODO
index e29d3b5..68ea4d5 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,4 @@
+* implement migration support with client fd
 * create a ChannelBaseAudio
 * revive the win32 GDI backend
 
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index fd52683..f59127e 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2468,6 +2468,10 @@ static gboolean channel_connect(SpiceChannel *channel)
 
     if (spice_session_get_client_provided_socket(c->session)) {
         if (c->fd == -1) {
+            CHANNEL_DEBUG(channel, "requesting fd");
+            /* FIXME: no way for client to provide fd atm. */
+            /* It could either chain on parent channel.. */
+            /* or register migration channel on parent session, or ? */
             g_signal_emit(channel, signals[SPICE_CHANNEL_OPEN_FD], 0, c->tls);
             return true;
         }
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 42ad280..d8cb790 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -1237,12 +1237,20 @@ SpiceSession *spice_session_new(void)
 G_GNUC_INTERNAL
 SpiceSession *spice_session_new_from_session(SpiceSession *session)
 {
-    SpiceSession *copy = SPICE_SESSION(g_object_new(SPICE_TYPE_SESSION,
-                                                    "host", NULL,
-                                                    "ca-file", NULL,
-                                                    NULL));
-    SpiceSessionPrivate *c = copy->priv, *s = session->priv;
+    SpiceSessionPrivate *s = session->priv;
+    SpiceSession *copy;
+    SpiceSessionPrivate *c;
+
+    if (s->client_provided_sockets) {
+        g_warning("migration with client provided fd is not supported yet");
+        return NULL;
+    }
 
+    copy = SPICE_SESSION(g_object_new(SPICE_TYPE_SESSION,
+                                      "host", NULL,
+                                      "ca-file", NULL,
+                                      NULL));
+    c = copy->priv;
     g_clear_object(&c->proxy);
 
     g_warn_if_fail(c->host == NULL);
-- 
1.9.3



More information about the Spice-devel mailing list