static int net_socket_connect_init(NetClientState *peer,

                                   const char *model,

                                   const char *name,

                                   const char *host_str)

{

    socket_connect_data *c = g_new0(socket_connect_data, 1);

    int fd = -1;

    Error *local_error = NULL;



    c->peer = peer;

    c->model = g_strdup(model);

    c->name = g_strdup(name);

    c->saddr = socket_parse(host_str, &local_error);

    if (c->saddr == NULL) {

        goto err;

    }



    fd = socket_connect(c->saddr, net_socket_connected, c, &local_error);

    if (fd < 0) {

        goto err;

    }



    return 0;



err:

    error_report_err(local_error);

    socket_connect_data_free(c);

    return -1;

}

static int net_socket_connect_init(NetClientState *peer,

                                   const char *model,

                                   const char *name,

                                   const char *host_str)

{

    socket_connect_data *c = g_new0(socket_connect_data, 1);

    int fd = -1;

    Error *local_error = NULL;



    c->peer = peer;

    c->model = g_strdup(model);

    c->name = g_strdup(name);

    c->saddr = socket_parse(host_str, &local_error);

    if (c->saddr == NULL) {

        goto err;

    }



    fd = socket_connect(c->saddr, net_socket_connected, c, &local_error);

    if (fd < 0) {

        goto err;

    }



    return 0;



err:

    error_report_err(local_error);

    socket_connect_data_free(c);

    return -1;

}

static int FUNC_0(NetClientState *VAR_0,

                                   const char *VAR_1,

                                   const char *VAR_2,

                                   const char *VAR_3)

{

    socket_connect_data *c = g_new0(socket_connect_data, 1);

    int VAR_4 = -1;

    Error *local_error = NULL;



    c->VAR_0 = VAR_0;

    c->VAR_1 = g_strdup(VAR_1);

    c->VAR_2 = g_strdup(VAR_2);

    c->saddr = socket_parse(VAR_3, &local_error);

    if (c->saddr == NULL) {

        goto err;

    }



    VAR_4 = socket_connect(c->saddr, net_socket_connected, c, &local_error);

    if (VAR_4 < 0) {

        goto err;

    }



    return 0;



err:

    error_report_err(local_error);

    socket_connect_data_free(c);

    return -1;

}

static int FUNC_0(NetClientState *VAR_0,
const char *VAR_1,
const char *VAR_2,
const char *VAR_3)
{ socket_connect_data *c = g_new0(socket_connect_data, 1); int VAR_4 = -1; Error *local_error = NULL; c->VAR_0 = VAR_0; c->VAR_1 = g_strdup(VAR_1); c->VAR_2 = g_strdup(VAR_2); c->saddr = socket_parse(VAR_3, &local_error); if (c->saddr == NULL) { goto err; } VAR_4 = socket_connect(c->saddr, net_socket_connected, c, &local_error); if (VAR_4 < 0) { goto err; } return 0; err:
error_report_err(local_error); socket_connect_data_free(c); return -1; }