From 3a5e7c43342d987084c4ef69771337efde19ff68 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 11 Mar 2019 16:33:17 +0300 Subject: [PATCH] Do not hold cs_vNodes in CSigSharesManager::SendMessages() for too long (#2758) --- src/llmq/quorums_signing_shares.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/llmq/quorums_signing_shares.cpp b/src/llmq/quorums_signing_shares.cpp index dbe199c3a3..d7eb20ebf2 100644 --- a/src/llmq/quorums_signing_shares.cpp +++ b/src/llmq/quorums_signing_shares.cpp @@ -1059,7 +1059,9 @@ bool CSigSharesManager::SendMessages() bool didSend = false; - g_connman->ForEachNode([&](CNode* pnode) { + std::vector vNodesCopy = g_connman->CopyNodeVector(CConnman::FullyConnectedOnly); + + for (auto& pnode : vNodesCopy) { CNetMsgMaker msgMaker(pnode->GetSendVersion()); auto it1 = sigSessionAnnouncements.find(pnode->id); @@ -1145,9 +1147,10 @@ bool CSigSharesManager::SendMessages() didSend = true; } } + } - return true; - }); + // looped through all nodes, release them + g_connman->ReleaseNodeVector(vNodesCopy); if (didSend) { g_connman->WakeSelect();