static void tcp_cleanup(FdMigrationState *s)
{
if (s->detach == 2) {
- monitor_resume();
- s->detach = 0;
+ monitor_resume();
+ s->detach = 0;
}
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
if (s->file) {
debug_me = 1;
dprintf("closing file\n");
- qemu_fclose(s->file);
+ qemu_fclose(s->file);
}
if (s->fd != -1)
- close(s->fd);
+ close(s->fd);
s->fd = -1;
}
FdMigrationState *s = opaque;
dprintf("fd_close\n");
if (s->fd != -1) {
- close(s->fd);
- s->fd = -1;
+ close(s->fd);
+ s->fd = -1;
}
return 0;
}
dprintf("wait for unfreeze\n");
if (s->state != MIG_STATE_ACTIVE)
- return;
+ return;
do {
fd_set wfds;
if (s->state != MIG_STATE_ACTIVE) {
dprintf("put_ready returning because of non-active state\n");
- return;
+ return;
}
dprintf("iterate\n");
bdrv_flush_all();
qemu_savevm_state_complete(s->file);
- s->state = MIG_STATE_COMPLETED;
- tcp_cleanup(s);
+ s->state = MIG_STATE_COMPLETED;
+ tcp_cleanup(s);
}
}
ret = qemu_savevm_state_begin(s->file);
if (ret < 0) {
dprintf("failed, %d\n", ret);
- tcp_error(s);
+ tcp_error(s);
return;
}
} while (ret == -1 && socket_error() == EINTR);
if (ret < 0) {
- tcp_error(s);
+ tcp_error(s);
return;
}
tcp_connect_migrate(s);
else {
dprintf("error connecting %d\n", val);
- tcp_error(s);
+ tcp_error(s);
}
}
FdMigrationState *s = to_fms(mig_state);
if (s->state != MIG_STATE_ACTIVE)
- return;
+ return;
dprintf("cancelling migration\n");
dprintf("releasing state\n");
if (s->state == MIG_STATE_ACTIVE) {
- s->state = MIG_STATE_CANCELLED;
- tcp_cleanup(s);
+ s->state = MIG_STATE_CANCELLED;
+ tcp_cleanup(s);
}
free(s);
}
MigrationState *tcp_start_outgoing_migration(const char *host_port,
- int64_t bandwidth_limit,
- int async)
+ int64_t bandwidth_limit,
+ int async)
{
struct sockaddr_in addr;
FdMigrationState *s;
s->fd = socket(PF_INET, SOCK_STREAM, 0);
if (s->fd == -1) {
qemu_free(s);
- return NULL;
+ return NULL;
}
socket_set_nonblock(s->fd);
if (s->detach == 1) {
dprintf("detaching from monitor\n");
monitor_suspend();
- s->detach = 2;
+ s->detach = 2;
}
do {