aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-03-30 13:09:48 +0200
committerDan Engelbrecht <[email protected]>2022-03-30 13:09:48 +0200
commit8246081588870f7afcefacd9ea5fbcc44bfa4c47 (patch)
tree817a8741fa410a2a702acf8cb4a01478d0421bff /zenserver/cache/structuredcachestore.cpp
parentFix bucket creation race condition in ZenCacheMemoryLayer::Put (diff)
downloadzen-8246081588870f7afcefacd9ea5fbcc44bfa4c47.tar.xz
zen-8246081588870f7afcefacd9ea5fbcc44bfa4c47.zip
cleanup
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
-rw-r--r--zenserver/cache/structuredcachestore.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index 3d7fac13b..66240f0c6 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -249,11 +249,9 @@ ZenCacheMemoryLayer::Put(std::string_view InBucket, const IoHash& HashKey, const
{
RwLock::SharedLockScope _(m_Lock);
- auto it = m_Buckets.find(std::string(InBucket));
-
- if (it != m_Buckets.end())
+ if (auto It = m_Buckets.find(std::string(InBucket)); It != m_Buckets.end())
{
- Bucket = &it->second;
+ Bucket = &It->second;
}
}
@@ -263,10 +261,9 @@ ZenCacheMemoryLayer::Put(std::string_view InBucket, const IoHash& HashKey, const
RwLock::ExclusiveLockScope _(m_Lock);
- auto it = m_Buckets.find(std::string(InBucket));
- if (it != m_Buckets.end())
+ if (auto It = m_Buckets.find(std::string(InBucket)); It != m_Buckets.end())
{
- Bucket = &it->second;
+ Bucket = &It->second;
}
else
{