Lock cs_vSend and cs_inventory in a consistent order even in TRY

This commit is contained in:
Matt Corallo 2017-02-02 20:03:46 -05:00
parent 1c2edd9f67
commit fd13eca147

View file

@ -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)