Skip to content

Commit fd13eca

Browse files
committed
Lock cs_vSend and cs_inventory in a consistent order even in TRY
1 parent 1c2edd9 commit fd13eca

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/net.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,12 +1070,13 @@ void CConnman::ThreadSocketHandler()
10701070
{
10711071
bool fDelete = false;
10721072
{
1073-
TRY_LOCK(pnode->cs_vSend, lockSend);
1074-
if (lockSend)
1073+
TRY_LOCK(pnode->cs_inventory, lockInv);
1074+
if (lockInv)
10751075
{
1076-
TRY_LOCK(pnode->cs_inventory, lockInv);
1077-
if (lockInv)
1078-
fDelete = true;
1076+
TRY_LOCK(pnode->cs_vSend, lockSend);
1077+
if (lockSend) {
1078+
fDelete = true;
1079+
}
10791080
}
10801081
}
10811082
if (fDelete)

0 commit comments

Comments
 (0)