From fd13eca147be80f3ebd1a5a1db1ce75bbeeb1953 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 2 Feb 2017 20:03:46 -0500 Subject: [PATCH] Lock cs_vSend and cs_inventory in a consistent order even in TRY --- src/net.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index df88b12c7..5cddc6f44 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -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)