Lock cs_vSend and cs_inventory in a consistent order even in TRY
Zcash: We haven't removed cs_vRecv yet, so left it in between. (cherry picked from commit bitcoin/bitcoin@fd13eca147)
This commit is contained in:
parent
dadbb36e29
commit
c2b5cf6e51
|
@ -1126,15 +1126,16 @@ void ThreadSocketHandler()
|
||||||
{
|
{
|
||||||
bool fDelete = false;
|
bool fDelete = false;
|
||||||
{
|
{
|
||||||
TRY_LOCK(pnode->cs_vSend, lockSend);
|
TRY_LOCK(pnode->cs_inventory, lockInv);
|
||||||
if (lockSend)
|
if (lockInv)
|
||||||
{
|
{
|
||||||
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
|
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
|
||||||
if (lockRecv)
|
if (lockRecv)
|
||||||
{
|
{
|
||||||
TRY_LOCK(pnode->cs_inventory, lockInv);
|
TRY_LOCK(pnode->cs_vSend, lockSend);
|
||||||
if (lockInv)
|
if (lockSend) {
|
||||||
fDelete = true;
|
fDelete = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue