qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v10 17/24] migration: Export functions to create


From: Daniel P . Berrangé
Subject: Re: [Qemu-devel] [PATCH v10 17/24] migration: Export functions to create send channels
Date: Wed, 7 Mar 2018 12:00:21 +0000
User-agent: Mutt/1.9.2 (2017-12-15)

On Wed, Mar 07, 2018 at 12:00:03PM +0100, Juan Quintela wrote:
> 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)

This should use the proper typedef

   socket_send_channel_create(QIOTaskFunc f, 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);

Again use the proper typedef for the callback


> +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
> 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]