*/
#include "qemu-common.h"
-#include "qemu_socket.h"
-#include "migration.h"
-#include "qemu-char.h"
-#include "buffered_file.h"
-#include "block.h"
+#include "qemu/sockets.h"
+#include "migration/migration.h"
+#include "migration/qemu-file.h"
+#include "block/block.h"
//#define DEBUG_MIGRATION_TCP
{
int r = 0;
DPRINTF("tcp_close\n");
- if (s->fd != -1) {
- if (close(s->fd) < 0) {
- r = -errno;
- }
- s->fd = -1;
+ if (closesocket(s->fd) < 0) {
+ r = -socket_error();
}
return r;
}
} else {
DPRINTF("migrate connect success\n");
s->fd = fd;
+ socket_set_block(s->fd);
migrate_fd_connect(s);
}
}
c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen);
} while (c == -1 && socket_error() == EINTR);
qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
- close(s);
+ closesocket(s);
DPRINTF("accepted migration\n");
}
process_incoming_migration(f);
- qemu_fclose(f);
+ return;
+
out:
- close(c);
+ closesocket(c);
}
void tcp_start_incoming_migration(const char *host_port, Error **errp)