mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-24 13:45:52 +00:00
@@ -246,7 +246,7 @@ public:
|
||||
void
|
||||
updateRange(uint32_t newMax)
|
||||
{
|
||||
std::unique_lock lck(rngMtx_);
|
||||
std::scoped_lock lck(rngMtx_);
|
||||
assert(!range || newMax >= range->maxSequence);
|
||||
if (!range)
|
||||
range = {newMax, newMax};
|
||||
|
||||
@@ -37,7 +37,7 @@ SimpleCache::update(
|
||||
return;
|
||||
|
||||
{
|
||||
std::unique_lock lck{mtx_};
|
||||
std::scoped_lock lck{mtx_};
|
||||
if (seq > latestSeq_)
|
||||
{
|
||||
assert(seq == latestSeq_ + 1 || latestSeq_ == 0);
|
||||
@@ -125,7 +125,7 @@ SimpleCache::setFull()
|
||||
return;
|
||||
|
||||
full_ = true;
|
||||
std::unique_lock lck{mtx_};
|
||||
std::scoped_lock lck{mtx_};
|
||||
deletes_.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
std::optional<T>
|
||||
tryPop()
|
||||
{
|
||||
std::unique_lock lck(m_);
|
||||
std::scoped_lock lck(m_);
|
||||
if (queue_.empty())
|
||||
return {};
|
||||
T ret = std::move(queue_.front());
|
||||
|
||||
@@ -58,7 +58,7 @@ ForwardCache::freshen()
|
||||
resp = {};
|
||||
|
||||
{
|
||||
std::unique_lock lk(mtx_);
|
||||
std::scoped_lock lk(mtx_);
|
||||
latestForwarded_[command] = resp;
|
||||
}
|
||||
});
|
||||
@@ -68,7 +68,7 @@ ForwardCache::freshen()
|
||||
void
|
||||
ForwardCache::clear()
|
||||
{
|
||||
std::unique_lock lk(mtx_);
|
||||
std::scoped_lock lk(mtx_);
|
||||
for (auto& cacheEntry : latestForwarded_)
|
||||
latestForwarded_[cacheEntry.first] = {};
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
void
|
||||
setLastPublish()
|
||||
{
|
||||
std::unique_lock lck(publishTimeMtx_);
|
||||
std::scoped_lock lck(publishTimeMtx_);
|
||||
lastPublish_ = std::chrono::system_clock::now();
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ private:
|
||||
void
|
||||
setLastClose(std::chrono::time_point<ripple::NetClock> lastCloseTime)
|
||||
{
|
||||
std::unique_lock lck(closeTimeMtx_);
|
||||
std::scoped_lock lck(closeTimeMtx_);
|
||||
lastCloseTime_ = lastCloseTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ Counters::initializeCounter(std::string const& method)
|
||||
if (methodInfo_.count(method) == 0)
|
||||
{
|
||||
lk.unlock();
|
||||
std::unique_lock ulk(mutex_);
|
||||
std::scoped_lock ulk(mutex_);
|
||||
|
||||
// This calls the default constructor for methodInfo of the method.
|
||||
methodInfo_[method];
|
||||
|
||||
@@ -497,7 +497,7 @@ SubscriptionManager::subscribeHelper(
|
||||
CleanupFunction&& func)
|
||||
{
|
||||
subs.subscribe(session);
|
||||
std::unique_lock lk(cleanupMtx_);
|
||||
std::scoped_lock lk(cleanupMtx_);
|
||||
cleanupFuncs_[session].push_back(std::move(func));
|
||||
}
|
||||
template <typename Key>
|
||||
@@ -509,14 +509,14 @@ SubscriptionManager::subscribeHelper(
|
||||
CleanupFunction&& func)
|
||||
{
|
||||
subs.subscribe(session, k);
|
||||
std::unique_lock lk(cleanupMtx_);
|
||||
std::scoped_lock lk(cleanupMtx_);
|
||||
cleanupFuncs_[session].push_back(std::move(func));
|
||||
}
|
||||
|
||||
void
|
||||
SubscriptionManager::cleanup(std::shared_ptr<WsBase> session)
|
||||
{
|
||||
std::unique_lock lk(cleanupMtx_);
|
||||
std::scoped_lock lk(cleanupMtx_);
|
||||
if (!cleanupFuncs_.contains(session))
|
||||
return;
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
return true;
|
||||
|
||||
{
|
||||
std::unique_lock lck(mtx_);
|
||||
std::scoped_lock lck(mtx_);
|
||||
if (ipState_.find(ip) != ipState_.end())
|
||||
{
|
||||
auto [transferedByte, requests] = ipState_.at(ip);
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
{
|
||||
if (whitelist_.contains(ip))
|
||||
return;
|
||||
std::unique_lock lck{mtx_};
|
||||
std::scoped_lock lck{mtx_};
|
||||
ipConnCount_[ip]++;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
{
|
||||
if (whitelist_.contains(ip))
|
||||
return;
|
||||
std::unique_lock lck{mtx_};
|
||||
std::scoped_lock lck{mtx_};
|
||||
assert(ipConnCount_[ip] > 0);
|
||||
ipConnCount_[ip]--;
|
||||
if (ipConnCount_[ip] == 0)
|
||||
@@ -189,7 +189,7 @@ public:
|
||||
return true;
|
||||
|
||||
{
|
||||
std::unique_lock lck(mtx_);
|
||||
std::scoped_lock lck(mtx_);
|
||||
ipState_[ip].transferedByte += numObjects;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
return true;
|
||||
|
||||
{
|
||||
std::unique_lock lck(mtx_);
|
||||
std::scoped_lock lck(mtx_);
|
||||
ipState_[ip].requestsCount++;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
void
|
||||
clear() noexcept override
|
||||
{
|
||||
std::unique_lock lck(mtx_);
|
||||
std::scoped_lock lck(mtx_);
|
||||
ipState_.clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user