summary refs log tree commit diff stats
path: root/migration/qemu-file-channel.c
diff options
context:
space:
mode:
authorLukas Straub <lukasstraub2@web.de>2020-12-28 16:08:52 +0100
committerMarkus Armbruster <armbru@redhat.com>2021-01-13 10:21:17 +0100
commitb5eea99ec2f5cf6fa0ac12a757c8873b1d2a73a4 (patch)
tree1da5e550295be9561b50181d937f17266b2f3c13 /migration/qemu-file-channel.c
parent8ee4480692fe750f8ee7bcaa432250225da88a85 (diff)
downloadfocaccia-qemu-b5eea99ec2f5cf6fa0ac12a757c8873b1d2a73a4.tar.gz
focaccia-qemu-b5eea99ec2f5cf6fa0ac12a757c8873b1d2a73a4.zip
migration: Add yank feature
Register yank functions on sockets to shut them down.

Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <484c6a14cc2506bebedd5a237259b91363ff8f88.1609167865.git.lukasstraub2@web.de>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'migration/qemu-file-channel.c')
-rw-r--r--migration/qemu-file-channel.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
index d2ce32f4b9..afc3a7f642 100644
--- a/migration/qemu-file-channel.c
+++ b/migration/qemu-file-channel.c
@@ -27,6 +27,7 @@
 #include "qemu-file.h"
 #include "io/channel-socket.h"
 #include "qemu/iov.h"
+#include "qemu/yank.h"
 
 
 static ssize_t channel_writev_buffer(void *opaque,
@@ -104,6 +105,12 @@ static int channel_close(void *opaque, Error **errp)
     int ret;
     QIOChannel *ioc = QIO_CHANNEL(opaque);
     ret = qio_channel_close(ioc, errp);
+    if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)
+        && OBJECT(ioc)->ref == 1) {
+        yank_unregister_function(MIGRATION_YANK_INSTANCE,
+                                 yank_generic_iochannel,
+                                 QIO_CHANNEL(ioc));
+    }
     object_unref(OBJECT(ioc));
     return ret;
 }