aboutsummaryrefslogtreecommitdiffstats
path: root/migration/socket.c
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2024-02-22 17:53:00 +0800
committerPeter Xu <peterx@redhat.com>2024-02-28 11:31:28 +0800
commit72b90b96872acc5d00f9c16dfc196543349361da (patch)
tree00e7e16319bb768a3adc5b61bcaf6ff41363434c /migration/socket.c
parentmigration/multifd: Make multifd_channel_connect() return void (diff)
downloadqemu-72b90b96872acc5d00f9c16dfc196543349361da.tar.xz
qemu-72b90b96872acc5d00f9c16dfc196543349361da.zip
migration/multifd: Cleanup outgoing_args in state destroy
outgoing_args is a global cache of socket address to be reused in multifd. Freeing the cache in per-channel destructor is more or less a hack. Move it to multifd_send_cleanup_state() so it only get checked once. Use a small helper to do so because it's internal of socket.c. Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240222095301.171137-5-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration/socket.c')
-rw-r--r--migration/socket.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/migration/socket.c b/migration/socket.c
index 98e3ea1514..3184c7c3c1 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -64,10 +64,6 @@ int socket_send_channel_destroy(QIOChannel *send)
{
/* Remove channel */
object_unref(OBJECT(send));
- if (outgoing_args.saddr) {
- qapi_free_SocketAddress(outgoing_args.saddr);
- outgoing_args.saddr = NULL;
- }
return 0;
}
@@ -137,6 +133,14 @@ void socket_start_outgoing_migration(MigrationState *s,
NULL);
}
+void socket_cleanup_outgoing_migration(void)
+{
+ if (outgoing_args.saddr) {
+ qapi_free_SocketAddress(outgoing_args.saddr);
+ outgoing_args.saddr = NULL;
+ }
+}
+
static void socket_accept_incoming_migration(QIONetListener *listener,
QIOChannelSocket *cioc,
gpointer opaque)