diff mbox series

[12/17] migration/multifd: Consolidate TLS/non-TLS multifd channel error flow

Message ID 20240125162528.7552-13-avihaih@nvidia.com (mailing list archive)
State New, archived
Headers show
Series migration: Add new migration channel connect and TLS upgrade APIs | expand

Commit Message

Avihai Horon Jan. 25, 2024, 4:25 p.m. UTC
The error flows of TLS and non-TLS multifd channel creation are similar
yet they don't share code. Consolidate the flows by using
multifd_new_send_channel_cleanup() also in TLS error flow.

Signed-off-by: Avihai Horon <avihaih@nvidia.com>
---
 migration/multifd.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/migration/multifd.c b/migration/multifd.c
index f4d8cd0023..cc9a1182fa 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -794,6 +794,9 @@  static bool multifd_channel_connect(MultiFDSendParams *p,
                                     QIOChannel *ioc,
                                     Error **errp);
 
+static void multifd_new_send_channel_cleanup(MultiFDSendParams *p,
+                                             QIOChannel *ioc, Error *err);
+
 static void multifd_tls_outgoing_handshake(QIOChannel *ioc, gpointer opaque,
                                            Error *err)
 {
@@ -805,17 +808,7 @@  static void multifd_tls_outgoing_handshake(QIOChannel *ioc, gpointer opaque,
         }
     }
 
-    migrate_set_error(migrate_get_current(), err);
-    /*
-     * Error happen, mark multifd_send_thread status as 'quit' although it
-     * is not created, and then tell who pay attention to me.
-     */
-    p->quit = true;
-    qemu_sem_post(&multifd_send_state->channels_ready);
-    qemu_sem_post(&p->sem_sync);
-    qemu_sem_post(&p->create_sem);
-    error_free(err);
-    object_unref(OBJECT(ioc));
+    multifd_new_send_channel_cleanup(p, ioc, err);
 }
 
 static bool multifd_channel_connect(MultiFDSendParams *p,