[Spice-commits] 3 commits - src/channel-main.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 5 10:04:38 UTC 2019


 src/channel-main.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit a8cf5ff53830074af608b1ac61b0afca2cfbe657
Author: Victor Toso <me at victortoso.com>
Date:   Tue Sep 3 16:23:01 2019 +0200

    main: code style on main_migrate_connect()
    
    1) Make one argument per line, instead of 1, 2, 1
    2) Use session variable that already exists
    3) Don't cast again to SpiceChannel
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/channel-main.c b/src/channel-main.c
index 3d1b1b5..334be7d 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2337,7 +2337,8 @@ static gboolean migrate_connect(gpointer data)
 
 /* coroutine context */
 static void main_migrate_connect(SpiceChannel *channel,
-                                 SpiceMigrationDstInfo *dst_info, bool do_seamless,
+                                 SpiceMigrationDstInfo *dst_info,
+                                 bool do_seamless,
                                  uint32_t src_mig_version)
 {
     SpiceMainChannelPrivate *main_priv = SPICE_MAIN_CHANNEL(channel)->priv;
@@ -2379,13 +2380,12 @@ static void main_migrate_connect(SpiceChannel *channel,
             SPICE_DEBUG("migration (semi-seamless): connections all ok");
             reply_type = SPICE_MSGC_MAIN_MIGRATE_CONNECTED;
         }
-        spice_session_start_migrating(spice_channel_get_session(channel),
-                                      mig.do_seamless);
+        spice_session_start_migrating(session, mig.do_seamless);
     }
 
 end:
     CHANNEL_DEBUG(channel, "migrate connect reply %d", reply_type);
-    out = spice_msg_out_new(SPICE_CHANNEL(channel), reply_type);
+    out = spice_msg_out_new(channel, reply_type);
     spice_msg_out_send(out);
 }
 
commit d77b2db80c246b57beec15c257511bb03e4faf41
Author: Victor Toso <me at victortoso.com>
Date:   Tue Sep 3 14:59:44 2019 +0200

    main: migration: check return value to count channels
    
    Although spice_channel_connect() works in idle, if it returns false
    it'll not emit any signal further and we would be counting a
    'connected' channel that wouldn't be emitting anything.
    
    As other callbacks take this in consideration, we should only
    increment the counter if we reached spice-channel::connect_delayed()
    callback.
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/channel-main.c b/src/channel-main.c
index a1e5498..3d1b1b5 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2174,8 +2174,9 @@ migrate_channel_connect(spice_migrate *mig, int type, int id)
     SPICE_DEBUG("migrate_channel_connect %d:%d", type, id);
 
     SpiceChannel *newc = spice_channel_new(mig->session, type, id);
-    spice_channel_connect(newc);
-    mig->nchannels++;
+    if (newc != NULL && spice_channel_connect(newc)) {
+        mig->nchannels++;
+    }
 }
 
 /* coroutine context */
commit 6538d15b59b3d389abbc919fcc9e9e8bd70a24f0
Author: Victor Toso <me at victortoso.com>
Date:   Tue Sep 3 14:51:01 2019 +0200

    main: return void on migrate_channel_connect()
    
    The migration process would happen in idle, so the process only fails
    at a later time. No call to migrate_channel_connect() is actually
    checking the return value.
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/channel-main.c b/src/channel-main.c
index afdc1ce..a1e5498 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2168,15 +2168,14 @@ static void migrate_channel_new_cb(SpiceSession *s, SpiceChannel *channel, gpoin
                      G_CALLBACK(migrate_channel_event_cb), data);
 }
 
-static SpiceChannel* migrate_channel_connect(spice_migrate *mig, int type, int id)
+static void
+migrate_channel_connect(spice_migrate *mig, int type, int id)
 {
     SPICE_DEBUG("migrate_channel_connect %d:%d", type, id);
 
     SpiceChannel *newc = spice_channel_new(mig->session, type, id);
     spice_channel_connect(newc);
     mig->nchannels++;
-
-    return newc;
 }
 
 /* coroutine context */


More information about the Spice-commits mailing list