[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v10 17/24] migration: Export functions to create sen
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH v10 17/24] migration: Export functions to create send channels |
Date: |
Wed, 7 Mar 2018 12:00:03 +0100 |
Signed-off-by: Juan Quintela <address@hidden>
---
migration/socket.c | 28 +++++++++++++++++++++++++++-
migration/socket.h | 3 +++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/migration/socket.c b/migration/socket.c
index 26110739cf..b3b5571ebb 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -39,6 +39,28 @@ int socket_recv_channel_unref(QIOChannel *recv)
return 0;
}
+struct SocketOutgoingArgs {
+ SocketAddress *saddr;
+} outgoing_args;
+
+void socket_send_channel_create(void (*f)(QIOTask *, gpointer), void *data)
+{
+ QIOChannelSocket *sioc = qio_channel_socket_new();
+ qio_channel_socket_connect_async(sioc, outgoing_args.saddr,
+ f, data, NULL);
+}
+
+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;
+}
+
static SocketAddress *tcp_build_address(const char *host_port, Error **errp)
{
SocketAddress *saddr;
@@ -106,6 +128,11 @@ static void socket_start_outgoing_migration(MigrationState
*s,
struct SocketConnectData *data = g_new0(struct SocketConnectData, 1);
data->s = s;
+
+ /* in case previous migration leaked it */
+ qapi_free_SocketAddress(outgoing_args.saddr);
+ outgoing_args.saddr = saddr;
+
if (saddr->type == SOCKET_ADDRESS_TYPE_INET) {
data->hostname = g_strdup(saddr->u.inet.host);
}
@@ -116,7 +143,6 @@ static void socket_start_outgoing_migration(MigrationState
*s,
socket_outgoing_migration,
data,
socket_connect_data_free);
- qapi_free_SocketAddress(saddr);
}
void tcp_start_outgoing_migration(MigrationState *s,
diff --git a/migration/socket.h b/migration/socket.h
index 638a85255a..cbdb8d64c3 100644
--- a/migration/socket.h
+++ b/migration/socket.h
@@ -23,6 +23,9 @@
int socket_recv_channel_ref(QIOChannel *recv);
int socket_recv_channel_unref(QIOChannel *recv);
+void socket_send_channel_create(void (*f)(QIOTask *, gpointer), void *data);
+int socket_send_channel_destroy(QIOChannel *send);
+
void tcp_start_incoming_migration(const char *host_port, Error **errp);
void tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
--
2.14.3
- Re: [Qemu-devel] [PATCH v10 19/24] migration: Create multifd channels, (continued)
[Qemu-devel] [PATCH v10 23/24] migration: Create pages structure for reception, Juan Quintela, 2018/03/07
[Qemu-devel] [PATCH v10 21/24] migration: Transmit initial package through the multifd channels, Juan Quintela, 2018/03/07
[Qemu-devel] [PATCH v10 20/24] migration: Delay start of migration main routines, Juan Quintela, 2018/03/07
[Qemu-devel] [PATCH v10 22/24] migration: Create ram_multifd_page, Juan Quintela, 2018/03/07
[Qemu-devel] [PATCH v10 17/24] migration: Export functions to create send channels,
Juan Quintela <=
[Qemu-devel] [PATCH v10 24/24] [RFC] migration: Send pages through the multifd channels, Juan Quintela, 2018/03/07
Re: [Qemu-devel] [RFC v10 00/24] Multifd, no-reply, 2018/03/07