[spice-gtk,v1,2/2] channel-main: abort migration on bogus server message

Submitted by Victor Toso on Sept. 26, 2019, 5:45 p.m.

Details

Message ID 20190926174536.19730-2-victortoso@redhat.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Victor Toso Sept. 26, 2019, 5:45 p.m.
From: Victor Toso <me@victortoso.com>

In case server sends start migration without canceling previous one,
abort migration; Also aborts migration if failed to create the
SpiceSession for target host.

Note that the check for the new SpiceSession on target host is done in
spice_session_set_migration_session() already.

Signed-off-by: Victor Toso <victortoso@redhat.com>
---
 src/channel-main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/channel-main.c b/src/channel-main.c
index 4305dcd..45fdd58 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2356,10 +2356,10 @@  static void main_migrate_connect(SpiceChannel *channel,
     CHANNEL_DEBUG(channel, "migrate connect");
     session = spice_channel_get_session(channel);
     mig.session = spice_session_new_from_session(session);
-    if (mig.session == NULL)
-        goto end;
-    if (!spice_session_set_migration_session(session, mig.session))
+    if (!spice_session_set_migration_session(session, mig.session)) {
+        spice_session_abort_migration(session);
         goto end;
+    }
 
     main_priv->migrate_data = &mig;