Ejemplo n.º 1
0
static lcb_error_t refresh_file(clconfig_provider *pb)
{
    file_provider *provider = (file_provider *)pb;
    lcb_error_t err;

    if (provider->async) {
        return LCB_SUCCESS;
    }

    LOG(provider, TRACE, "Starting async file load");
    provider->async = lcb_async_create(pb->parent->settings->io,
                                       pb,
                                       async_callback,
                                       &err);

    lcb_assert(err == LCB_SUCCESS);
    lcb_assert(provider->async != NULL);

    return err;
}
Ejemplo n.º 2
0
/**
 * set_next listener callback which schedules an async call to our config
 * callback.
 */
static void async_step_callback(clconfig_listener *listener,
                                clconfig_event_t event,
                                clconfig_info *info)
{
    lcb_error_t err;
    struct lcb_bootstrap_st *bs = (struct lcb_bootstrap_st *)listener;

    if (event != CLCONFIG_EVENT_GOT_NEW_CONFIG) {
        return;
    }

    if (bs->timer) {
        lcb_log(LOGARGS(bs->parent, DEBUG), "Timer already present..");
        return;
    }

    lcb_log(LOGARGS(bs->parent, INFO), "Got async step callback..");

    bs->timer = lcb_async_create(bs->parent->settings.io,
                                 bs, async_refresh, &err);

    (void)info;
}