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:
Matt Corallo 2017-02-02 20:03:46 -05:00 committed by Jack Grigg
parent dadbb36e29
commit c2b5cf6e51
1 changed files with 5 additions and 4 deletions

View File

@ -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;
}
} }
} }
} }