Do not hold cs_vNodes in CSigSharesManager::SendMessages() for too long (#2758)

This commit is contained in:
UdjinM6 2019-03-11 16:33:17 +03:00 committed by GitHub
parent fbf0dcb086
commit 3a5e7c4334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1059,7 +1059,9 @@ bool CSigSharesManager::SendMessages()
bool didSend = false; bool didSend = false;
g_connman->ForEachNode([&](CNode* pnode) { std::vector<CNode*> vNodesCopy = g_connman->CopyNodeVector(CConnman::FullyConnectedOnly);
for (auto& pnode : vNodesCopy) {
CNetMsgMaker msgMaker(pnode->GetSendVersion()); CNetMsgMaker msgMaker(pnode->GetSendVersion());
auto it1 = sigSessionAnnouncements.find(pnode->id); auto it1 = sigSessionAnnouncements.find(pnode->id);
@ -1145,9 +1147,10 @@ bool CSigSharesManager::SendMessages()
didSend = true; didSend = true;
} }
} }
}
return true; // looped through all nodes, release them
}); g_connman->ReleaseNodeVector(vNodesCopy);
if (didSend) { if (didSend) {
g_connman->WakeSelect(); g_connman->WakeSelect();