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

Marc-André Lureau marcandre.lureau at redhat.com
Sun Nov 9 08:31:37 PST 2014


This is not yet supported, so fail early.
---
 TODO                |  2 +-
 gtk/spice-channel.c |  4 ++++
 gtk/spice-session.c | 18 +++++++++++++-----
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/TODO b/TODO
index 34e2c39..68ea4d5 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,5 @@
+* implement migration support with client fd
 * create a ChannelBaseAudio
-* missing TunnelChannel implementation
 * revive the win32 GDI backend
 
 See also list of bugs open:
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index ed18e09..93c2a78 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 ad19d93..39b5c85 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