nca_hist
RB_ENTRY(nca_hist) entry;
static RB_HEAD(nca_hist_tree, nca_hist) ncas_hist = RB_INITIALIZER(&ncas_hist);
nca_hist_cmp(const struct nca_hist *a, const struct nca_hist *b)
RB_GENERATE_STATIC(nca_hist_tree, nca_hist, entry, nca_hist_cmp);
nca_hist_free(struct nca_hist *nca_hist)
if (nca_hist == NULL)
free(nca_hist->aki);
free(nca_hist->ski);
free(nca_hist->location);
free(nca_hist->mfturi);
free(nca_hist->baseuri);
free(nca_hist->notify);
free(nca_hist);
struct nca_hist *nca_hist, *nca_hist_tmp;
RB_FOREACH_SAFE(nca_hist, nca_hist_tree, &ncas_hist, nca_hist_tmp) {
RB_REMOVE(nca_hist_tree, &ncas_hist, nca_hist);
nca_hist_free(nca_hist);
nca_decide_retry(const struct nca_hist *nca_hist)
if (nca_hist->attempts < 3)
if ((now - nca_hist->since < 24 * 60 * 60) &&
(now > nca_hist->last_attempt + 90 * 60))
if ((now - nca_hist->since > 24 * 60 * 60) &&
(now - nca_hist->last_attempt > 24 * 60 * 60))
struct nca_hist *nca_hist;
RB_FOREACH(nca_hist, nca_hist_tree, &ncas_hist) {
if (nca_decide_retry(nca_hist) == 0) {
nca_hist->defer = 1;
strlist_insert(&batchlist, nca_hist->baseuri);
if (nca_hist->notify != NULL && rrdpon)
strlist_insert(&batchlist, nca_hist->notify);
RB_FOREACH(nca_hist, nca_hist_tree, &ncas_hist) {
if (strlist_find(&batchlist, nca_hist->baseuri,
strlen(nca_hist->baseuri))) {
nca_hist->defer = 0;
if (nca_hist->notify != NULL && rrdpon) {
if (strlist_find(&batchlist, nca_hist->notify,
strlen(nca_hist->notify))) {
nca_hist->defer = 0;
struct nca_hist *nca_hist = NULL;
if ((nca_hist = calloc(1, sizeof(*nca_hist))) == NULL)
if ((nca_hist->aki = strdup(aki)) == NULL)
if ((nca_hist->ski = strdup(ski)) == NULL)
nca_hist->since = strtonum(since, 1, LLONG_MAX, &errstr);
if (nca_hist->since > now)
nca_hist->last_attempt = strtonum(last_attempt, 1,
if (nca_hist->last_attempt > now)
nca_hist->attempts = strtonum(attempts, 1, LLONG_MAX,
if ((nca_hist->location = strdup(loc)) == NULL)
if (!rsync_base_uri(mfturi, &nca_hist->baseuri))
if ((nca_hist->mfturi = strdup(mfturi)) == NULL)
if ((nca_hist->notify = strdup(notify)) == NULL)
if (RB_INSERT(nca_hist_tree, &ncas_hist, nca_hist) != NULL)
nca_hist_free(nca_hist);
struct nca_hist *nca_hist, needle;
const struct nca_hist *nca_hist)
nca_hist = RB_FIND(nca_hist_tree, &ncas_hist, &needle);
return nca_tree_insert_cert(ncas, cert, nca_hist);
if (nca_hist != NULL) {
nca->since = nca_hist->since;
nca->last_attempt = nca_hist->last_attempt;
nca->attempts = nca_hist->attempts;
nca->defer = nca_hist->defer;