struct cache_cage {
struct cache_node const *refresh;
struct cache_node const *fallback;
- struct uri rpkiNotify;
- struct mft_meta *mft; /* Fallback */
+ struct mft_meta *mft; /* Fallback XXX not set */
};
struct cache_commit {
{
struct cache_node *node;
struct cache_cage *cage;
- struct uri rpkiNotify;
validation_verdict vv;
// XXX Make sure somewhere validates rpkiManifest matches caRepository.
/* Try RRDP + optional fallback */
if (uri_str(&uris->rpkiNotify) != NULL) {
vv = do_refresh(&cache.rrdp, &uris->rpkiNotify, &node);
- if (vv == VV_CONTINUE) {
- rpkiNotify = uris->rpkiNotify;
+ if (vv == VV_CONTINUE)
goto refresh_success;
- }
if (vv == VV_BUSY)
return VV_BUSY;
}
/* Try rsync + optional fallback */
vv = do_refresh(&cache.rsync, &uris->caRepository, &node);
- if (vv == VV_CONTINUE) {
- memset(&rpkiNotify, 0, sizeof(rpkiNotify));
+ if (vv == VV_CONTINUE)
goto refresh_success;
- }
if (vv == VV_BUSY)
return VV_BUSY;
refresh_success:
*result = cage = pzalloc(sizeof(struct cache_cage));
- cage->rpkiNotify = rpkiNotify;
cage->refresh = node;
cage->fallback = get_fallback(uris);
return VV_CONTINUE;
{
struct cache_commit *commit;
- commit = pmalloc(sizeof(struct cache_commit));
- uri_copy(&commit->rpkiNotify, rpkiNotify);
+ pr_trc("Listing for commit: [%s, %s]",
+ rpkiNotify ? uri_str(rpkiNotify) : "NULL",
+ uri_str(caRepository));
+
+ commit = pzalloc(sizeof(struct cache_commit));
+ if (rpkiNotify)
+ uri_copy(&commit->rpkiNotify, rpkiNotify);
uri_copy(&commit->caRepository, caRepository);
commit->files = rpp->files;
commit->nfiles = rpp->nfiles;
struct uri const *
cage_rpkiNotify(struct cache_cage *cage)
{
- return &cage->rpkiNotify;
+ struct cache_node const *node;
+
+ node = cage->refresh;
+ if (node)
+ goto yes;
+ node = cage->fallback;
+ if (node)
+ goto yes;
+ return NULL;
+
+yes: return node->rrdp ? &node->key.http : NULL;
}
static void
} else { /* TA */
struct cache_mapping *map = &commit->files[0];
- pr_trc("Creating fallback for %s",
- uri_str(&map->url));
+ pr_trc("Creating fallback for %s", uri_str(&map->url));
fb = provide_node(&cache.fallback, &map->url, NULL);
fb->attempt_ts = now;