summaryrefslogtreecommitdiff
path: root/methods/file.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2022-04-24 00:24:40 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2024-11-22 12:21:24 +0000
commit370e024224b8116840173201d51c0c2a170e0e93 (patch)
tree567f548125e1e3c6d5c68e8e0960eadf8a5b5cf0 /methods/file.cc
parent496c8b4191790231258e644ac8cd4096d54f445f (diff)
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.
Diffstat (limited to 'methods/file.cc')
-rw-r--r--methods/file.cc2
1 files changed, 2 insertions, 0 deletions
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