src/siri/admin/client.c
/*
 * In case a client request fails, this function should be called to end
 * the request. A package with the error message will be send to the client.
 */
In case a client request fails, this function should be called to end
the request. A package with the error message will be send to the client.
In case a client request fails this function should be called to end the request . A package with the error message will be send to the client .
static void CLIENT_err(
        siri_admin_client_t * adm_client,
        const char * fmt,
        ...)
{
    char err_msg[SIRI_MAX_SIZE_ERR_MSG];
    va_list args;
    va_start(args, fmt);
    vsnprintf(err_msg, SIRI_MAX_SIZE_ERR_MSG, fmt, args);
    va_end(args);
    sirinet_pkg_t * package = sirinet_pkg_err(
            adm_client->pid,
            strlen(err_msg),
            CPROTO_ERR_ADMIN,
            err_msg);
    if (package != NULL)
    {
        sirinet_pkg_send(adm_client->client, package);
    }
    log_error(err_msg);
    if (~adm_client->flags & CLIENT_FLAGS_NO_ROLLBACK)
    {
        siri_admin_request_rollback(adm_client->dbpath);
    }
    sirinet_socket_decref(siri.socket);
    uv_close((uv_handle_t *) &siri.timer, NULL);
}
static void CLIENT_err ( siri_admin_client_t * adm_client , const char * fmt , ... ) { char err_msg [ SIRI_MAX_SIZE_ERR_MSG ] ; va_list args ; va_start ( args , fmt ) ; vsnprintf ( err_msg , SIRI_MAX_SIZE_ERR_MSG , fmt , args ) ; va_end ( args ) ; sirinet_pkg_t * package = sirinet_pkg_err ( adm_client -> pid , strlen ( err_msg ) , CPROTO_ERR_ADMIN , err_msg ) ; if ( package != NULL ) { sirinet_pkg_send ( adm_client -> client , package ) ; } log_error ( err_msg ) ; if ( ~ adm_client -> flags & CLIENT_FLAGS_NO_ROLLBACK ) { siri_admin_request_rollback ( adm_client -> dbpath ) ; } sirinet_socket_decref ( siri . socket ) ; uv_close ( ( uv_handle_t * ) & siri . timer , NULL ) ; }
In case a client request fails, this function should be called to end
 the request.
In case a client request fails this function should be called to end the request .