diff --git a/migration/tls.h b/migration/tls.h
index 514529ff38..a6babbfa14 100644
--- a/migration/tls.h
+++ b/migration/tls.h
@@ -32,9 +32,6 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc,
                                            const char *hostname,
                                            Error **errp);
 
-void migration_tls_channel_connect_main(MigrationState *s, QIOChannel *ioc,
-                                        const char *hostname, Error **errp);
-
 typedef void (*MigTLSConCallback)(QIOChannel *ioc, void *opaque, Error *err);
 
 /**
diff --git a/migration/channel.c b/migration/channel.c
index 041a63eb21..4022b2c9b8 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -50,6 +50,14 @@ void migration_channel_process_incoming(QIOChannel *ioc)
     }
 }
 
+static void migration_channel_tls_handshake_main(QIOChannel *ioc, void *opaque,
+                                                 Error *err)
+{
+    MigrationState *s = opaque;
+
+    migration_channel_connect(s, ioc, NULL, err);
+    object_unref(OBJECT(ioc));
+}
 
 /**
  * @migration_channel_connect - Create new outgoing migration channel
@@ -69,14 +77,16 @@ void migration_channel_connect(MigrationState *s,
 
     if (!error) {
         if (migrate_channel_requires_tls_upgrade(ioc)) {
-            migration_tls_channel_connect_main(s, ioc, hostname, &error);
-
-            if (!error) {
-                /* tls_channel_connect will call back to this
-                 * function after the TLS handshake,
-                 * so we mustn't call migrate_fd_connect until then
+            /* Save hostname into MigrationState for handshake */
+            s->hostname = g_strdup(hostname);
+            if (migration_tls_channel_connect(
+                    ioc, "main", hostname, migration_channel_tls_handshake_main,
+                    s, false, &error)) {
+                /*
+                 * migration_channel_tls_handshake_main will call back to this
+                 * function after the TLS handshake, so we mustn't call
+                 * migrate_fd_connect until then.
                  */
-
                 return;
             }
         } else {
diff --git a/migration/tls.c b/migration/tls.c
index e6a0349bd1..99c71e4fb6 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -97,24 +97,6 @@ void migration_tls_channel_process_incoming(MigrationState *s,
                               NULL);
 }
 
-
-static void migration_tls_outgoing_handshake_main(QIOTask *task,
-                                                  gpointer opaque)
-{
-    MigrationState *s = opaque;
-    QIOChannel *ioc = QIO_CHANNEL(qio_task_get_source(task));
-    Error *err = NULL;
-
-    if (qio_task_propagate_error(task, &err)) {
-        trace_migration_tls_outgoing_handshake_main_error(
-            error_get_pretty(err));
-    } else {
-        trace_migration_tls_outgoing_handshake_main_complete();
-    }
-    migration_channel_connect(s, ioc, NULL, err);
-    object_unref(OBJECT(ioc));
-}
-
 QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc,
                                            const char *hostname,
                                            Error **errp)
@@ -134,24 +116,6 @@ QIOChannelTLS *migration_tls_client_create(QIOChannel *ioc,
     return qio_channel_tls_new_client(ioc, creds, hostname, errp);
 }
 
-void migration_tls_channel_connect_main(MigrationState *s, QIOChannel *ioc,
-                                        const char *hostname, Error **errp)
-{
-    QIOChannelTLS *tioc;
-
-    tioc = migration_tls_client_create(ioc, hostname, errp);
-    if (!tioc) {
-        return;
-    }
-
-    /* Save hostname into MigrationState for handshake */
-    s->hostname = g_strdup(hostname);
-    trace_migration_tls_outgoing_handshake_main_start(hostname);
-    qio_channel_set_name(QIO_CHANNEL(tioc), "migration-tls-outgoing");
-    qio_channel_tls_handshake(tioc, migration_tls_outgoing_handshake_main, s,
-                              NULL, NULL);
-}
-
 typedef struct {
     QIOChannelTLS *tioc;
     MigTLSConCallback callback;
diff --git a/migration/trace-events b/migration/trace-events
index 09dd342d37..80c3c20faa 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -325,9 +325,6 @@ migration_socket_outgoing_connected(const char *hostname) "hostname=%s"
 migration_socket_outgoing_error(const char *err) "error=%s"
 
 # tls.c
-migration_tls_outgoing_handshake_main_start(const char *hostname) "hostname=%s"
-migration_tls_outgoing_handshake_main_error(const char *err) "err=%s"
-migration_tls_outgoing_handshake_main_complete(void) ""
 migration_tls_outgoing_handshake_start(const char *hostname, const char *name) "hostname=%s, name=%s"
 migration_tls_outgoing_handshake_error(const char *name, const char *err) "name=%s, err=%s"
 migration_tls_outgoing_handshake_complete(const char *name) "name=%s"
