X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=access_rx_cache.cpp;h=7633c3112530ff67fc52b8305ae67ff3d6b8ea0e;hb=de3bb58078cdcaf357a9a0c37648596c85615bc2;hp=c6f56347e8ecf543ebfeb4af567c351d5039f77f;hpb=d5ba26d705460a7e37213eeb4954b2efed8bebf0;p=plocate diff --git a/access_rx_cache.cpp b/access_rx_cache.cpp index c6f5634..7633c31 100644 --- a/access_rx_cache.cpp +++ b/access_rx_cache.cpp @@ -11,6 +11,11 @@ using namespace std; void AccessRXCache::check_access(const char *filename, bool allow_async, function cb) { + if (!check_visibility) { + cb(true); + return; + } + lock_guard lock(mu); if (engine == nullptr || !engine->get_supports_stat()) { allow_async = false; @@ -50,7 +55,7 @@ void AccessRXCache::check_access(const char *filename, bool allow_async, functio it->second.emplace_back(PendingStat{ filename, move(cb) }); } else { it = pending_stats.emplace(filename, vector{}).first; - engine->submit_stat(filename, [this, it, filename{ strdup(filename) }, cb{ move(cb) }] { + engine->submit_stat(filename, [this, it, filename{ strdup(filename) }, cb{ move(cb) }](bool) { // The stat returned, so now do the actual access() calls. // All of them should be in cache, so don't fire off new statx() // calls during that check.