mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge #19347: [net] Make cs_inventory nonrecursive
e8a2822119[net] Don't try to take cs_inventory before deleting CNode (John Newbery)3556227ddd[net] Make cs_inventory a non-recursive mutex (John Newbery)344e831de5[net processing] Remove PushBlockInventory and PushBlockHash (John Newbery) Pull request description: - Remove PushBlockInventory() and PushBlockHash(). These are one-line functions that can easy be inlined into the calling code. Doing so also allows us to eliminate the one place that cs_inventory is recursively locked. - Make cs_inventory a nonrecursive mutex - Remove a redundant TRY_LOCK of cs_inventory when deleting CNode. ACKs for top commit: sipa: utACKe8a2822119MarcoFalke: ACKe8a2822119🍬 hebasto: re-ACKe8a2822119Tree-SHA512: dbc721d102cdef7b5827a8f2549daf8b54f543050266999a7ea56c9f36618565b71e31ce0beb1209ba2db43d15388be173355a03fb6db8ad24e2475b145050bd
This commit is contained in:
@@ -1110,12 +1110,9 @@ void CConnman::DisconnectNodes()
|
||||
if (pnode->GetRefCount() <= 0) {
|
||||
bool fDelete = false;
|
||||
{
|
||||
TRY_LOCK(pnode->cs_inventory, lockInv);
|
||||
if (lockInv) {
|
||||
TRY_LOCK(pnode->cs_vSend, lockSend);
|
||||
if (lockSend) {
|
||||
fDelete = true;
|
||||
}
|
||||
TRY_LOCK(pnode->cs_vSend, lockSend);
|
||||
if (lockSend) {
|
||||
fDelete = true;
|
||||
}
|
||||
}
|
||||
if (fDelete) {
|
||||
|
||||
Reference in New Issue
Block a user