Browse Source

net: only disconnect if fDisconnect has been set

These conditions are problematic to check without locking, and we shouldn't be
relying on the refcount to disconnect.
0.14
Cory Fields 8 years ago
parent
commit
f6315e07f9
  1. 3
      src/net.cpp

3
src/net.cpp

@ -1051,8 +1051,7 @@ void CConnman::ThreadSocketHandler() @@ -1051,8 +1051,7 @@ void CConnman::ThreadSocketHandler()
std::vector<CNode*> vNodesCopy = vNodes;
BOOST_FOREACH(CNode* pnode, vNodesCopy)
{
if (pnode->fDisconnect ||
(pnode->GetRefCount() <= 0 && pnode->vRecvMsg.empty() && pnode->nSendSize == 0))
if (pnode->fDisconnect)
{
// remove from vNodes
vNodes.erase(remove(vNodes.begin(), vNodes.end(), pnode), vNodes.end());

Loading…
Cancel
Save