mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-13 11:40:42 +02:00
[docs] Improve commenting in ProcessGetData()
This commit is contained in:
parent
2f032556e0
commit
9847e205bf
@ -1604,10 +1604,14 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm
|
|||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
// Process as many TX items from the front of the getdata queue as
|
||||||
|
// possible, since they're common and it's efficient to batch process
|
||||||
|
// them.
|
||||||
while (it != pfrom->vRecvGetData.end() && (it->type == MSG_TX || it->type == MSG_WITNESS_TX)) {
|
while (it != pfrom->vRecvGetData.end() && (it->type == MSG_TX || it->type == MSG_WITNESS_TX)) {
|
||||||
if (interruptMsgProc)
|
if (interruptMsgProc)
|
||||||
return;
|
return;
|
||||||
// Don't bother if send buffer is too full to respond anyway
|
// The send buffer provides backpressure. If there's no space in
|
||||||
|
// the buffer, pause processing until the next call.
|
||||||
if (pfrom->fPauseSend)
|
if (pfrom->fPauseSend)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1644,6 +1648,8 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm
|
|||||||
}
|
}
|
||||||
} // release cs_main
|
} // release cs_main
|
||||||
|
|
||||||
|
// Only process one BLOCK item per call, since they're uncommon and can be
|
||||||
|
// expensive to process.
|
||||||
if (it != pfrom->vRecvGetData.end() && !pfrom->fPauseSend) {
|
if (it != pfrom->vRecvGetData.end() && !pfrom->fPauseSend) {
|
||||||
const CInv &inv = *it++;
|
const CInv &inv = *it++;
|
||||||
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK || inv.type == MSG_CMPCT_BLOCK || inv.type == MSG_WITNESS_BLOCK) {
|
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK || inv.type == MSG_CMPCT_BLOCK || inv.type == MSG_WITNESS_BLOCK) {
|
||||||
|
Loading…
Reference in New Issue
Block a user