mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 10:35:50 +00:00
Fix out-of-bounds reserve, and some minor optimizations
This commit is contained in:
committed by
manojsdoshi
parent
4a9bd7ed6d
commit
bc91fd740f
@@ -1164,20 +1164,22 @@ OverlayImpl::getActivePeers(
|
|||||||
std::lock_guard lock(mutex_);
|
std::lock_guard lock(mutex_);
|
||||||
|
|
||||||
active = ids_.size();
|
active = ids_.size();
|
||||||
ret.reserve(ids_.size() - toSkip.size());
|
disabled = enabledInSkip = 0;
|
||||||
|
ret.reserve(ids_.size());
|
||||||
|
|
||||||
for (auto& [id, w] : ids_)
|
for (auto& [id, w] : ids_)
|
||||||
{
|
{
|
||||||
if (auto p = w.lock())
|
if (auto p = w.lock())
|
||||||
{
|
{
|
||||||
// tx rr feature disabled
|
bool const reduceRelayEnabled = p->txReduceRelayEnabled();
|
||||||
if (!p->txReduceRelayEnabled())
|
// tx reduced relay feature disabled
|
||||||
disabled++;
|
if (!reduceRelayEnabled)
|
||||||
|
++disabled;
|
||||||
|
|
||||||
if (toSkip.count(id) == 0)
|
if (toSkip.count(id) == 0)
|
||||||
ret.emplace_back(std::move(p));
|
ret.emplace_back(std::move(p));
|
||||||
else if (p->txReduceRelayEnabled())
|
else if (reduceRelayEnabled)
|
||||||
enabledInSkip++;
|
++enabledInSkip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user