From 969e9554a31385b2d2c09695dab984d585dc2693 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Mon, 21 Sep 2026 06:42:39 -1000 Subject: Harden the request path, scan and error recovery --- source/cache.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'source/cache.h') diff --git a/source/cache.h b/source/cache.h index a653108..bae283c 100644 --- a/source/cache.h +++ b/source/cache.h @@ -19,18 +19,20 @@ typedef void (*cache_fill_fn)(void); */ extern int cache_process(int size, const char *path, const char *key, int ttl, cache_fill_fn fn); -// Write one line per cache slot to stdout, giving its path, modification -// time, size and key. +/* + * Write one line per cache slot to stdout, giving its path, modification time, + * size and key. + */ extern int cache_ls(const char *path); /* - * Give up on the slot being filled, discarding what has been rendered into it - * and putting stdout back on the client. Anything that ends a request part way - * through rendering has to call this before it writes what the visitor should - * see, because until then stdout is the cache file and the visitor is on - * course to receive nothing at all. Does nothing when no slot is being filled. + * Give up on the slot being filled and put stdout back on the client, after + * sending what was rendered into the slot so far. Anything that ends a request + * part way through rendering has to call this before it writes what the + * visitor should see, because until then stdout is the cache file. Returns + * non-zero when a fill was abandoned and zero when none was in progress. */ -extern void cache_abandon_fill(void); +extern int cache_abandon_fill(void); extern unsigned long cache_hash_str(const char *str); -- cgit v2.8.0