]> git.ipfire.org Git - thirdparty/FORT-validator.git/commit
Improve the cache fallback algorithm
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 31 Oct 2023 18:17:34 +0000 (12:17 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Fri, 3 Nov 2023 23:01:39 +0000 (17:01 -0600)
commit604f845ce6b9eb596dc9f1fdff7a7fa5752fcc87
tree38a88cacb88d7da8632b6a42cbe622082b6140a1
parentd48e56b91f13b9111b0135fce574c7ae98c1eae1
Improve the cache fallback algorithm

If all of a RPP's URLs fail, fall back to most sensible cached
candidate.
It seems this used to be only implemented for TAs, and the heuristics
for choosing a suitable fallback were rudimentary.
Elaborate, centralize and extend implementation to all cache content.

Side maintenance tweaks:

- Remove EREQFAILED, because it largely evolved from meaning "don't try
  again" to "try again." So now it was just a redundant EAGAIN.
- Ditch redundant arguments from valid_file_or_dir().
- Merge the three URI arraylist implementations (certificate.c, tal.c
  and manifest.c) into one.
- Move RRDP workspace URI, from a thread variable to the stack.
  (Code smell. It used to be awkward to follow this variable's lifespan
  through the tree traversal.)
- Move struct publish and struct withdraw from the heap to the stack.
  (Eliminate pointless allocations. These are not the only RRDP
  structures I want to move to the stack.)
- Change file_metadata.uri from `char *` to `struct rpki_uri *`.
  (This string was forcing the RRDP code to recompute the URI
  repeatedly.)
26 files changed:
src/abbreviations.txt
src/cache/local_cache.c
src/cache/local_cache.h
src/common.c
src/common.h
src/config.c
src/data_structure/array_list.h
src/http/http.c
src/object/certificate.c
src/object/manifest.c
src/object/manifest.h
src/object/tal.c
src/rpp.c
src/rrdp/rrdp_loader.c
src/rrdp/rrdp_objects.c
src/rrdp/rrdp_objects.h
src/rrdp/rrdp_parser.c
src/rsync/rsync.c
src/state.c
src/state.h
src/types/uri.c
src/types/uri.h
test/cache/local_cache_test.c
test/mock.c
test/tal_test.c
test/types/uri_test.c