[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 01/17] migrate: Add gboolean return type to m
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-devel] [PATCH v5 01/17] migrate: Add gboolean return type to migrate_channel_process_incoming |
Date: |
Wed, 19 Jul 2017 16:01:10 +0100 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
* Juan Quintela (address@hidden) wrote:
> Signed-off-by: Juan Quintela <address@hidden>
> ---
> migration/channel.c | 3 ++-
> migration/channel.h | 2 +-
> migration/exec.c | 6 ++++--
> migration/socket.c | 12 ++++++++----
> 4 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/migration/channel.c b/migration/channel.c
> index 3b7252f..719055d 100644
> --- a/migration/channel.c
> +++ b/migration/channel.c
> @@ -19,7 +19,7 @@
> #include "qapi/error.h"
> #include "io/channel-tls.h"
>
> -void migration_channel_process_incoming(QIOChannel *ioc)
> +gboolean migration_channel_process_incoming(QIOChannel *ioc)
> {
> MigrationState *s = migrate_get_current();
>
> @@ -39,6 +39,7 @@ void migration_channel_process_incoming(QIOChannel *ioc)
> QEMUFile *f = qemu_fopen_channel_input(ioc);
> migration_fd_process_incoming(f);
> }
> + return FALSE; /* unregister */
> }
>
>
> diff --git a/migration/channel.h b/migration/channel.h
> index e4b4057..72cbc9f 100644
> --- a/migration/channel.h
> +++ b/migration/channel.h
> @@ -18,7 +18,7 @@
>
> #include "io/channel.h"
>
> -void migration_channel_process_incoming(QIOChannel *ioc);
> +gboolean migration_channel_process_incoming(QIOChannel *ioc);
Can you add a comment here that says what the return value means.
Dave
> void migration_channel_connect(MigrationState *s,
> QIOChannel *ioc,
> diff --git a/migration/exec.c b/migration/exec.c
> index 08b599e..2827f15 100644
> --- a/migration/exec.c
> +++ b/migration/exec.c
> @@ -47,9 +47,11 @@ static gboolean exec_accept_incoming_migration(QIOChannel
> *ioc,
> GIOCondition condition,
> gpointer opaque)
> {
> - migration_channel_process_incoming(ioc);
> + gboolean result;
> +
> + result = migration_channel_process_incoming(ioc);
> object_unref(OBJECT(ioc));
> - return FALSE; /* unregister */
> + return result;
> }
>
> void exec_start_incoming_migration(const char *command, Error **errp)
> diff --git a/migration/socket.c b/migration/socket.c
> index 757d382..6195596 100644
> --- a/migration/socket.c
> +++ b/migration/socket.c
> @@ -136,25 +136,29 @@ static gboolean
> socket_accept_incoming_migration(QIOChannel *ioc,
> {
> QIOChannelSocket *sioc;
> Error *err = NULL;
> + gboolean result;
>
> sioc = qio_channel_socket_accept(QIO_CHANNEL_SOCKET(ioc),
> &err);
> if (!sioc) {
> error_report("could not accept migration connection (%s)",
> error_get_pretty(err));
> + result = FALSE; /* unregister */
> goto out;
> }
>
> trace_migration_socket_incoming_accepted();
>
> qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-incoming");
> - migration_channel_process_incoming(QIO_CHANNEL(sioc));
> + result = migration_channel_process_incoming(QIO_CHANNEL(sioc));
> object_unref(OBJECT(sioc));
>
> out:
> - /* Close listening socket as its no longer needed */
> - qio_channel_close(ioc, NULL);
> - return FALSE; /* unregister */
> + if (result == FALSE) {
> + /* Close listening socket as its no longer needed */
> + qio_channel_close(ioc, NULL);
> + }
> + return result;
> }
>
>
> --
> 2.9.4
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK
- [Qemu-devel] [PATCH v5 00/17] Multifd, Juan Quintela, 2017/07/17
- [Qemu-devel] [PATCH v5 02/17] migration: Create migration_ioc_process_incoming(), Juan Quintela, 2017/07/17
- [Qemu-devel] [PATCH v5 01/17] migrate: Add gboolean return type to migrate_channel_process_incoming, Juan Quintela, 2017/07/17
- Re: [Qemu-devel] [PATCH v5 01/17] migrate: Add gboolean return type to migrate_channel_process_incoming,
Dr. David Alan Gilbert <=
- [Qemu-devel] [PATCH v5 03/17] qio: Create new qio_channel_{readv, writev}_all, Juan Quintela, 2017/07/17
- [Qemu-devel] [PATCH v5 04/17] migration: Add multifd capability, Juan Quintela, 2017/07/17