aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--pacredir.c5
2 files changed, 6 insertions, 5 deletions
diff --git a/README.md b/README.md
index 4bcc937..11cbeb2 100644
--- a/README.md
+++ b/README.md
@@ -62,9 +62,9 @@ Do not worry if `pacman` reports:
This is ok, it just tells `pacman` that `pacredir` could not find a file
and downloading it from an official server is required.
-Please note that `pacredir` redirects to the most recent file found on
-the local network. To make sure you really do have the latest files run
-`pacman -Syu` *twice*.
+Please note that `pacredir` redirects to the most recent database file
+found on the local network if it is not too old (currently 24 hours). To
+make sure you really do have the latest files run `pacman -Syu` *twice*.
To get a better idea what happens in the background have a look at
[the request flow chart](FLOW.md).
diff --git a/pacredir.c b/pacredir.c
index bbb297c..82bba71 100644
--- a/pacredir.c
+++ b/pacredir.c
@@ -524,8 +524,9 @@ static mhd_result ahc_echo(void * cls,
}
if (request->http_code == MHD_HTTP_OK &&
- /* for db files choose the most recent server */
- ((dbfile == 1 && ((request->last_modified > last_modified) ||
+ /* for db files choose the most recent server when not too old */
+ ((dbfile == 1 && ((request->last_modified > last_modified &&
+ request->last_modified + 86400 > time(NULL)) ||
/* but use a faster server if available */
(url != NULL &&
request->last_modified >= last_modified &&