src/siri/admin/client.c
/*
 * Callback used to check if resolving an ip address was successful.
 */
Callback used to check if resolving an ip address was successful.
Callback used to check if resolving an ip address was successful .
static void CLIENT_on_resolved(
        uv_getaddrinfo_t * resolver,
        int status,
        struct addrinfo * res)
{
    siri_admin_client_t * adm_client = (siri_admin_client_t *) resolver->data;
    if (status < 0)
    {
        CLIENT_err(
                adm_client,
                "cannot resolve ip address for '%s' (error: %s)",
                adm_client->host,
                uv_err_name(status));
    }
    else
    {
        uv_connect_t * req = (uv_connect_t *) malloc(sizeof(uv_connect_t));
        if (req == NULL)
        {
            CLIENT_err(adm_client, "memory allocation error");
        }
        else
        {
            uv_tcp_connect(
                    req,
                    siri.socket,
                    (const struct sockaddr *) res->ai_addr,
                    CLIENT_on_connect);
        }
    }
    uv_freeaddrinfo(res);
    free(resolver);
}
static void CLIENT_on_resolved ( uv_getaddrinfo_t * resolver , int status , struct addrinfo * res ) { siri_admin_client_t * adm_client = ( siri_admin_client_t * ) resolver -> data ; if ( status < 0 ) { CLIENT_err ( adm_client , " " , adm_client -> host , uv_err_name ( status ) ) ; } else { uv_connect_t * req = ( uv_connect_t * ) malloc ( sizeof ( uv_connect_t ) ) ; if ( req == NULL ) { CLIENT_err ( adm_client , " " ) ; } else { uv_tcp_connect ( req , siri . socket , ( const struct sockaddr * ) res -> ai_addr , CLIENT_on_connect ) ; } } uv_freeaddrinfo ( res ) ; free ( resolver ) ; }
Callback used to check if resolving an ip address was successful.
Callback used to check if resolving an ip address was successful .