int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,

                                 Error **errp)

{

    s->get_error = socket_errno;

    s->write = socket_write;

    s->close = tcp_close;



    s->fd = inet_connect(host_port, false, NULL, errp);



    if (!error_is_set(errp)) {

        migrate_fd_connect(s);

    } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_IN_PROGRESS)) {

        DPRINTF("connect in progress\n");

        qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s);

    } else if (error_is_type(*errp, QERR_SOCKET_CREATE_FAILED)) {

        DPRINTF("connect failed\n");

        return -1;

    } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_FAILED)) {

        DPRINTF("connect failed\n");

        migrate_fd_error(s);

        return -1;

    } else {

        DPRINTF("unknown error\n");

        return -1;

    }



    return 0;

}

int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,

                                 Error **errp)

{

    s->get_error = socket_errno;

    s->write = socket_write;

    s->close = tcp_close;



    s->fd = inet_connect(host_port, false, NULL, errp);



    if (!error_is_set(errp)) {

        migrate_fd_connect(s);

    } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_IN_PROGRESS)) {

        DPRINTF("connect in progress\n");

        qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s);

    } else if (error_is_type(*errp, QERR_SOCKET_CREATE_FAILED)) {

        DPRINTF("connect failed\n");

        return -1;

    } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_FAILED)) {

        DPRINTF("connect failed\n");

        migrate_fd_error(s);

        return -1;

    } else {

        DPRINTF("unknown error\n");

        return -1;

    }



    return 0;

}

    s->fd = inet_connect(host_port, false, NULL, errp);     if (!error_is_set(errp)) {         migrate_fd_connect(s);     } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_IN_PROGRESS)) {     } else if (error_is_type(*errp, QERR_SOCKET_CREATE_FAILED)) {         DPRINTF("connect failed\n");         return -1;     } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_FAILED)) {         DPRINTF("connect failed\n");         migrate_fd_error(s);         return -1;         DPRINTF("unknown error\n");         return -1;
int FUNC_0(MigrationState *VAR_0, const char *VAR_1,

                                 Error **VAR_2)

{

    VAR_0->get_error = socket_errno;

    VAR_0->write = socket_write;

    VAR_0->close = tcp_close;



    VAR_0->fd = inet_connect(VAR_1, false, NULL, VAR_2);



    if (!error_is_set(VAR_2)) {

        migrate_fd_connect(VAR_0);

    } else if (error_is_type(*VAR_2, QERR_SOCKET_CONNECT_IN_PROGRESS)) {

        DPRINTF("connect in progress\n");

        qemu_set_fd_handler2(VAR_0->fd, NULL, NULL, tcp_wait_for_connect, VAR_0);

    } else if (error_is_type(*VAR_2, QERR_SOCKET_CREATE_FAILED)) {

        DPRINTF("connect failed\n");

        return -1;

    } else if (error_is_type(*VAR_2, QERR_SOCKET_CONNECT_FAILED)) {

        DPRINTF("connect failed\n");

        migrate_fd_error(VAR_0);

        return -1;

    } else {

        DPRINTF("unknown error\n");

        return -1;

    }



    return 0;

}

int FUNC_0(MigrationState *VAR_0, const char *VAR_1,
Error **VAR_2)
{ VAR_0->get_error = socket_errno; VAR_0->write = socket_write; VAR_0->close = tcp_close; VAR_0->fd = inet_connect(VAR_1, false, NULL, VAR_2); if (!error_is_set(VAR_2)) { migrate_fd_connect(VAR_0); } else if (error_is_type(*VAR_2, QERR_SOCKET_CONNECT_IN_PROGRESS)) { DPRINTF("connect in progress\n"); qemu_set_fd_handler2(VAR_0->fd, NULL, NULL, tcp_wait_for_connect, VAR_0); } else if (error_is_type(*VAR_2, QERR_SOCKET_CREATE_FAILED)) { DPRINTF("connect failed\n"); return -1; } else if (error_is_type(*VAR_2, QERR_SOCKET_CONNECT_FAILED)) { DPRINTF("connect failed\n"); migrate_fd_error(VAR_0); return -1; } else { DPRINTF("unknown error\n"); return -1; } return 0; }