static void net_socket_connected(int fd, Error *err, void *opaque)

{

    socket_connect_data *c = opaque;

    NetSocketState *s;

    char *addr_str = NULL;

    Error *local_error = NULL;



    addr_str = socket_address_to_string(c->saddr, &local_error);

    if (addr_str == NULL) {

        error_report_err(local_error);

        closesocket(fd);

        goto end;

    }



    s = net_socket_fd_init(c->peer, c->model, c->name, fd, true);

    if (!s) {

        closesocket(fd);

        goto end;

    }



    snprintf(s->nc.info_str, sizeof(s->nc.info_str),

             "socket: connect to %s", addr_str);



end:

    g_free(addr_str);

    socket_connect_data_free(c);

}

static void net_socket_connected(int fd, Error *err, void *opaque)

{

    socket_connect_data *c = opaque;

    NetSocketState *s;

    char *addr_str = NULL;

    Error *local_error = NULL;



    addr_str = socket_address_to_string(c->saddr, &local_error);

    if (addr_str == NULL) {

        error_report_err(local_error);

        closesocket(fd);

        goto end;

    }



    s = net_socket_fd_init(c->peer, c->model, c->name, fd, true);

    if (!s) {

        closesocket(fd);

        goto end;

    }



    snprintf(s->nc.info_str, sizeof(s->nc.info_str),

             "socket: connect to %s", addr_str);



end:

    g_free(addr_str);

    socket_connect_data_free(c);

}

static void FUNC_0(int VAR_0, Error *VAR_1, void *VAR_2)

{

    socket_connect_data *c = VAR_2;

    NetSocketState *s;

    char *VAR_3 = NULL;

    Error *local_error = NULL;



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

    if (VAR_3 == NULL) {

        error_report_err(local_error);

        closesocket(VAR_0);

        goto end;

    }



    s = net_socket_fd_init(c->peer, c->model, c->name, VAR_0, true);

    if (!s) {

        closesocket(VAR_0);

        goto end;

    }



    snprintf(s->nc.info_str, sizeof(s->nc.info_str),

             "socket: connect to %s", VAR_3);



end:

    g_free(VAR_3);

    socket_connect_data_free(c);

}

static void FUNC_0(int VAR_0, Error *VAR_1, void *VAR_2)
{ socket_connect_data *c = VAR_2; NetSocketState *s; char *VAR_3 = NULL; Error *local_error = NULL; VAR_3 = socket_address_to_string(c->saddr, &local_error); if (VAR_3 == NULL) { error_report_err(local_error); closesocket(VAR_0); goto end; } s = net_socket_fd_init(c->peer, c->model, c->name, VAR_0, true); if (!s) { closesocket(VAR_0); goto end; } snprintf(s->nc.info_str, sizeof(s->nc.info_str),
"socket: connect to %s", VAR_3); end:
g_free(VAR_3); socket_connect_data_free(c); }