aboutsummaryrefslogtreecommitdiff
path: root/migration/socket.c
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2021-04-21 12:28:33 +0100
committerDr. David Alan Gilbert <dgilbert@redhat.com>2021-06-08 19:36:19 +0100
commita59136f3b126cfbcaa13a44fbdaf8df6e3d1885f (patch)
treec13beef1dc33b19dae919442cf6d3cd600384611 /migration/socket.c
parent1df6ddb43b48eacf5e1c7f63f48b507716150e6f (diff)
migration/socket: Close the listener at the end
Delay closing the listener until the cleanup hook at the end; mptcp needs the listener to stay open while the other paths come in. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20210421112834.107651-5-dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration/socket.c')
-rw-r--r--migration/socket.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/migration/socket.c b/migration/socket.c
index 6016642e04..05705a32d8 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -126,22 +126,31 @@ static void socket_accept_incoming_migration(QIONetListener *listener,
{
trace_migration_socket_incoming_accepted();
- qio_channel_set_name(QIO_CHANNEL(cioc), "migration-socket-incoming");
- migration_channel_process_incoming(QIO_CHANNEL(cioc));
-
if (migration_has_all_channels()) {
- /* Close listening socket as its no longer needed */
- qio_net_listener_disconnect(listener);
- object_unref(OBJECT(listener));
+ error_report("%s: Extra incoming migration connection; ignoring",
+ __func__);
+ return;
}
+
+ qio_channel_set_name(QIO_CHANNEL(cioc), "migration-socket-incoming");
+ migration_channel_process_incoming(QIO_CHANNEL(cioc));
}
+static void
+socket_incoming_migration_end(void *opaque)
+{
+ QIONetListener *listener = opaque;
+
+ qio_net_listener_disconnect(listener);
+ object_unref(OBJECT(listener));
+}
static void
socket_start_incoming_migration_internal(SocketAddress *saddr,
Error **errp)
{
QIONetListener *listener = qio_net_listener_new();
+ MigrationIncomingState *mis = migration_incoming_get_current();
size_t i;
int num = 1;
@@ -156,6 +165,9 @@ socket_start_incoming_migration_internal(SocketAddress *saddr,
return;
}
+ mis->transport_data = listener;
+ mis->transport_cleanup = socket_incoming_migration_end;
+
qio_net_listener_set_client_func_full(listener,
socket_accept_incoming_migration,
NULL, NULL,