Пример #1
0
aeron_congestion_control_strategy_supplier_func_t aeron_congestion_control_strategy_supplier_load(
    const char *strategy_name)
{
    aeron_congestion_control_strategy_supplier_func_t func = NULL;

    if ((func = (aeron_congestion_control_strategy_supplier_func_t)aeron_dlsym(RTLD_DEFAULT, strategy_name)) == NULL)
    {
        aeron_set_err(EINVAL, "could not find congestion control strategy %s: dlsym - %s", strategy_name, aeron_dlerror());
        return NULL;
    }

    return func;
}
Пример #2
0
aeron_flow_control_strategy_supplier_func_t aeron_flow_control_strategy_supplier_load(const char *strategy_name)
{
    aeron_flow_control_strategy_supplier_func_t func = NULL;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    if ((func = (aeron_flow_control_strategy_supplier_func_t)aeron_dlsym(RTLD_DEFAULT, strategy_name)) == NULL)
    {
        aeron_set_err(EINVAL, "could not find flow control strategy %s: dlsym - %s", strategy_name, aeron_dlerror());
        return NULL;
    }
#pragma GCC diagnostic pop

    return func;
}
aeron_driver_termination_validator_func_t aeron_driver_termination_validator_load(const char *validator_name)
{
    aeron_driver_termination_validator_func_t func = NULL;

    if (strncmp(validator_name, "allow", sizeof("allow")) == 0)
    {
        return aeron_driver_termination_validator_load("aeron_driver_termination_validator_default_allow");
    }
    else if (strncmp(validator_name, "deny", sizeof("deny")) == 0)
    {
        return aeron_driver_termination_validator_load("aeron_driver_termination_validator_default_deny");
    }
    else
    {
        if ((func = (aeron_driver_termination_validator_func_t) aeron_dlsym(RTLD_DEFAULT, validator_name)) == NULL)
        {
            aeron_set_err(
                EINVAL, "could not find termination validator %s: dlsym - %s", validator_name, aeron_dlerror());
            return NULL;
        }
    }

    return func;
}