From 37a8239f442e54de8e55de41f95b8e4a4c972701 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 6 Oct 2008 18:32:27 +0200 Subject: directory: simplify list update handling logic Now the "update" command can be issued multiple times regardless of whether the client is in list mode or not. We serialize the update tasks to prevent updates from trampling over each other and will spawn another update task once the current one is finished updating and reaped. Right now we cap the queue size to 32 which is probably enough (I bet most people usually run update with no argument anyways); but we can make it grow/shrink dynamically if needed. There'll still be a hard-coded limit to prevent DoS attacks, though. --- src/directory.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/directory.h') diff --git a/src/directory.h b/src/directory.h index 42d0e2bb6..764902071 100644 --- a/src/directory.h +++ b/src/directory.h @@ -42,12 +42,12 @@ void reap_update_task(void); int isUpdatingDB(void); -/** - * Starts the tag cache update in the specified location(s). Returns - * the job id on success, -1 on error or 0 if an update is already - * running. +/* + * returns the non-negative update job ID on success, + * returns -1 if busy + * @path will be freed by this function and should not be reused */ -int updateInit(List * pathList); +int directory_update_init(char *path); void directory_init(void); -- cgit v1.2.3