[PATCH spice-gtk v2 01/19] migration: add a few more pre-conditions in migration code

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

 



Those preconditions help to figure out several issues related to
migration.
---
 gtk/channel-main.c  | 2 ++
 gtk/spice-channel.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 1ad090f..62e8905 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -2074,6 +2074,8 @@ static gboolean migrate_connect(gpointer data)
     g_return_val_if_fail(c != NULL, FALSE);
 
     session = spice_channel_get_session(mig->src_channel);
+    g_return_val_if_fail(session->priv->migration == NULL, FALSE);
+
     mig->session = spice_session_new_from_session(session);
     mig->session->priv->migration_copy = true;
 
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 6c24bf5..fd52683 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2500,6 +2500,8 @@ gboolean spice_channel_connect(SpiceChannel *channel)
     if (c->state >= SPICE_CHANNEL_STATE_CONNECTING)
         return TRUE;
 
+    g_return_val_if_fail(channel->priv->fd == -1, FALSE);
+
     return channel_connect(channel);
 }
 
@@ -2522,6 +2524,7 @@ gboolean spice_channel_open_fd(SpiceChannel *channel, int fd)
 
     g_return_val_if_fail(SPICE_IS_CHANNEL(channel), FALSE);
     g_return_val_if_fail(channel->priv != NULL, FALSE);
+    g_return_val_if_fail(channel->priv->fd == -1, FALSE);
     g_return_val_if_fail(fd >= -1, FALSE);
 
     c = channel->priv;
-- 
1.9.3

_______________________________________________
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]