From 370e024224b8116840173201d51c0c2a170e0e93 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 24 Apr 2022 00:24:40 +0200 Subject: Alternatively calculate alternative file hashes in file method If we do not have the requested file we haven't calculated the hashes for it either and it is likely that the alternative file will be used, so to save the main thread from being busy with calculating hashes we do the calculation here in the method. --- methods/file.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'methods/file.cc') diff --git a/methods/file.cc b/methods/file.cc index b2fe133f2..ff93f83d0 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -107,6 +107,8 @@ bool FileMethod::Fetch(FetchItem *Itm) AltRes.IMSHit = false; if (Itm->LastModified == Buf.st_mtime && Itm->LastModified != 0) AltRes.IMSHit = true; + if (Res.Filename.empty()) + CalculateHashes(Itm, AltRes); break; } // no break here as we could have situations similar to '.gz' vs '.tar.gz' here -- cgit v1.2.3-70-g09d2