Skip to content

Commit

Permalink
refactor: use a NodesSnapshot to avoid lock contention over m_nodes_m…
Browse files Browse the repository at this point in the history
…utex
  • Loading branch information
PastaPastaPasta committed Nov 20, 2024
1 parent 9d87d9d commit 35411e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/llmq/signing_shares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,9 +1364,10 @@ void CSigSharesManager::Cleanup()
nodeStatesToDelete.emplace(nodeId);
}
}
connman.ForEachNode([&nodeStatesToDelete](const CNode* pnode) {
const CConnman::NodesSnapshot snap{connman, /* filter = */ CConnman::FullyConnectedOnly};
for (const auto& pnode : snap.Nodes()) {
nodeStatesToDelete.erase(pnode->GetId());
});
}

// Now delete these node states
LOCK(cs);
Expand Down

0 comments on commit 35411e8

Please sign in to comment.