Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of Bitcoin PR #21750 (bitcoin/bitcoin#21750).
Referencing Bitcoin PR description, "[...] Indeed all locks of
CNode::cs_vSend
are done either when the referencecount is >0 or under the protection of
CConnman::cs_vNodes
and thenode being in
CConnman::vNodes
. [...]" still applies to Zend current codebase:TLSManager::threadSocketHandler
: node inCConnman::vNodes
andCConnman::cs_vNodes
protectedThreadSocketHandler
: node inCConnman::vNodes
andCConnman::cs_vNodes
protectedThreadMessageHandler
: reference count >0CNode::BeginMessage
/CNode::AbortMessage
/CNode::EndMessage
: called inPushMessage
, in turn called (directly/indirectly) inProcessMessages
/SendMessages
which fall in the case of reference count >0Regarding the other two locks:
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
: will be addressed by backport of Bitcoin PR #9441 (Net: Massive speedup. Net locks overhaul bitcoin/bitcoin#9441)TRY_LOCK(pnode->cs_inventory, lockInv);
: can be linked to Bitcoin PR #19347 ([net] Make cs_inventory nonrecursive bitcoin/bitcoin#19347), considering the commit message "[...] The only other places that cs_inventory can be taken are:ProcessMessages()
orSendMessages()
, when theCNode
'snRefCount
must be >0 (see
ThreadMessageHandler()
, where the refcount isincremented before calling
ProcessMessages()
andSendMessages()
).ForEachNode()
lambda inPeerLogicValidation::UpdatedBlockTip()
.ForEachNode()
lockscs_vNodes
and calls the function on theCNode
objects in
vNodes
. [...]"in Zend codebase there are some lockings on
cs_inventory
inActivateBestChain
,RelayAlternativeChain
,Relay
but they are protected throughconnman->cs_vNodes
, hence the lock can be removed.