Browse Source

Lock cs_vSend and cs_inventory in a consistent order even in TRY

0.14
Matt Corallo 8 years ago
parent
commit
fd13eca147
  1. 11
      src/net.cpp

11
src/net.cpp

@ -1070,12 +1070,13 @@ void CConnman::ThreadSocketHandler() @@ -1070,12 +1070,13 @@ void CConnman::ThreadSocketHandler()
{
bool fDelete = false;
{
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend)
TRY_LOCK(pnode->cs_inventory, lockInv);
if (lockInv)
{
TRY_LOCK(pnode->cs_inventory, lockInv);
if (lockInv)
fDelete = true;
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend) {
fDelete = true;
}
}
}
if (fDelete)

Loading…
Cancel
Save