Skip to content

Commit

Permalink
Lock cs_vSend and cs_inventory in a consistent order even in TRY
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlueMatt committed Feb 3, 2017
1 parent 1c2edd9 commit fd13eca
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fd13eca

Please sign in to comment.