aboutsummaryrefslogtreecommitdiff
path: root/migration/channel.c
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2017-12-15 17:16:55 +0000
committerDr. David Alan Gilbert <dgilbert@redhat.com>2018-02-06 10:55:12 +0000
commit688a3dcba980bf01344a1ae2bc37fea44c6014ac (patch)
tree2e42c331dedfab3743e5b3e7323b3805844c673c /migration/channel.c
parentcce8040bb0ea6ff56d8882aeb0a0435a61901d93 (diff)
migration: Route errors down through migration_channel_connect
Route async errors (especially from sockets) down through migration_channel_connect and on to migrate_fd_connect where they can be cleaned up. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration/channel.c')
-rw-r--r--migration/channel.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/migration/channel.c b/migration/channel.c
index fdb7ddbd17..c5eaf0fa0e 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -55,29 +55,29 @@ void migration_channel_process_incoming(QIOChannel *ioc)
* @s: Current migration state
* @ioc: Channel to which we are connecting
* @hostname: Where we want to connect
+ * @error: Error indicating failure to connect, free'd here
*/
void migration_channel_connect(MigrationState *s,
QIOChannel *ioc,
- const char *hostname)
+ const char *hostname,
+ Error *error)
{
trace_migration_set_outgoing_channel(
- ioc, object_get_typename(OBJECT(ioc)), hostname);
+ ioc, object_get_typename(OBJECT(ioc)), hostname, error);
- if (s->parameters.tls_creds &&
- *s->parameters.tls_creds &&
- !object_dynamic_cast(OBJECT(ioc),
- TYPE_QIO_CHANNEL_TLS)) {
- Error *local_err = NULL;
- migration_tls_channel_connect(s, ioc, hostname, &local_err);
- if (local_err) {
- migrate_fd_error(s, local_err);
- error_free(local_err);
- }
- } else {
- QEMUFile *f = qemu_fopen_channel_output(ioc);
+ if (!error) {
+ if (s->parameters.tls_creds &&
+ *s->parameters.tls_creds &&
+ !object_dynamic_cast(OBJECT(ioc),
+ TYPE_QIO_CHANNEL_TLS)) {
+ migration_tls_channel_connect(s, ioc, hostname, &error);
+ } else {
+ QEMUFile *f = qemu_fopen_channel_output(ioc);
- s->to_dst_file = f;
+ s->to_dst_file = f;
- migrate_fd_connect(s, NULL);
+ }
}
+ migrate_fd_connect(s, error);
+ error_free(error);
}