scripted-diff: rename vRecvGetData

-BEGIN VERIFY SCRIPT-
sed -i 's/vRecvGetData/m_getdata_requests/g' src/net_processing.cpp
-END VERIFY SCRIPT-
This commit is contained in:
Neha Narula
2020-09-30 14:23:28 -04:00
parent ba951812ec
commit da0988daf1

View File

@@ -515,10 +515,10 @@ struct Peer {
/** Set of txids to reconsider once their parent transactions have been accepted **/ /** Set of txids to reconsider once their parent transactions have been accepted **/
std::set<uint256> m_orphan_work_set GUARDED_BY(g_cs_orphans); std::set<uint256> m_orphan_work_set GUARDED_BY(g_cs_orphans);
/** Protects vRecvGetData **/ /** Protects m_getdata_requests **/
Mutex m_getdata_requests_mutex; Mutex m_getdata_requests_mutex;
/** Work queue of items requested by this peer **/ /** Work queue of items requested by this peer **/
std::deque<CInv> vRecvGetData GUARDED_BY(m_getdata_requests_mutex); std::deque<CInv> m_getdata_requests GUARDED_BY(m_getdata_requests_mutex);
Peer(NodeId id) : m_id(id) {} Peer(NodeId id) : m_id(id) {}
}; };
@@ -1759,7 +1759,7 @@ void static ProcessGetData(CNode& pfrom, Peer& peer, const CChainParams& chainpa
{ {
AssertLockNotHeld(cs_main); AssertLockNotHeld(cs_main);
std::deque<CInv>::iterator it = peer.vRecvGetData.begin(); std::deque<CInv>::iterator it = peer.m_getdata_requests.begin();
std::vector<CInv> vNotFound; std::vector<CInv> vNotFound;
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion()); const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
@@ -1771,7 +1771,7 @@ void static ProcessGetData(CNode& pfrom, Peer& peer, const CChainParams& chainpa
// Process as many TX items from the front of the getdata queue as // 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 // possible, since they're common and it's efficient to batch process
// them. // them.
while (it != peer.vRecvGetData.end() && it->IsGenTxMsg()) { while (it != peer.m_getdata_requests.end() && it->IsGenTxMsg()) {
if (interruptMsgProc) return; if (interruptMsgProc) return;
// The send buffer provides backpressure. If there's no space in // The send buffer provides backpressure. If there's no space in
// the buffer, pause processing until the next call. // the buffer, pause processing until the next call.
@@ -1819,7 +1819,7 @@ void static ProcessGetData(CNode& pfrom, Peer& peer, const CChainParams& chainpa
// Only process one BLOCK item per call, since they're uncommon and can be // Only process one BLOCK item per call, since they're uncommon and can be
// expensive to process. // expensive to process.
if (it != peer.vRecvGetData.end() && !pfrom.fPauseSend) { if (it != peer.m_getdata_requests.end() && !pfrom.fPauseSend) {
const CInv &inv = *it++; const CInv &inv = *it++;
if (inv.IsGenBlkMsg()) { if (inv.IsGenBlkMsg()) {
ProcessGetBlockData(pfrom, chainparams, inv, connman); ProcessGetBlockData(pfrom, chainparams, inv, connman);
@@ -1828,7 +1828,7 @@ void static ProcessGetData(CNode& pfrom, Peer& peer, const CChainParams& chainpa
// and continue processing the queue on the next call. // and continue processing the queue on the next call.
} }
peer.vRecvGetData.erase(peer.vRecvGetData.begin(), it); peer.m_getdata_requests.erase(peer.m_getdata_requests.begin(), it);
if (!vNotFound.empty()) { if (!vNotFound.empty()) {
// Let the peer know that we didn't find what it asked for, so it doesn't // Let the peer know that we didn't find what it asked for, so it doesn't
@@ -2812,7 +2812,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
{ {
LOCK(peer->m_getdata_requests_mutex); LOCK(peer->m_getdata_requests_mutex);
peer->vRecvGetData.insert(peer->vRecvGetData.end(), vInv.begin(), vInv.end()); peer->m_getdata_requests.insert(peer->m_getdata_requests.end(), vInv.begin(), vInv.end());
ProcessGetData(pfrom, *peer, m_chainparams, m_connman, m_mempool, interruptMsgProc); ProcessGetData(pfrom, *peer, m_chainparams, m_connman, m_mempool, interruptMsgProc);
} }
@@ -2933,7 +2933,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
CInv inv; CInv inv;
WITH_LOCK(cs_main, inv.type = State(pfrom.GetId())->fWantsCmpctWitness ? MSG_WITNESS_BLOCK : MSG_BLOCK); WITH_LOCK(cs_main, inv.type = State(pfrom.GetId())->fWantsCmpctWitness ? MSG_WITNESS_BLOCK : MSG_BLOCK);
inv.hash = req.blockhash; inv.hash = req.blockhash;
WITH_LOCK(peer->m_getdata_requests_mutex, peer->vRecvGetData.push_back(inv)); WITH_LOCK(peer->m_getdata_requests_mutex, peer->m_getdata_requests.push_back(inv));
// The message processing loop will go around again (without pausing) and we'll respond then // The message processing loop will go around again (without pausing) and we'll respond then
return; return;
} }
@@ -3886,7 +3886,7 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
{ {
LOCK(peer->m_getdata_requests_mutex); LOCK(peer->m_getdata_requests_mutex);
if (!peer->vRecvGetData.empty()) { if (!peer->m_getdata_requests.empty()) {
ProcessGetData(*pfrom, *peer, m_chainparams, m_connman, m_mempool, interruptMsgProc); ProcessGetData(*pfrom, *peer, m_chainparams, m_connman, m_mempool, interruptMsgProc);
} }
} }
@@ -3902,10 +3902,10 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
return false; return false;
// this maintains the order of responses // this maintains the order of responses
// and prevents vRecvGetData to grow unbounded // and prevents m_getdata_requests to grow unbounded
{ {
LOCK(peer->m_getdata_requests_mutex); LOCK(peer->m_getdata_requests_mutex);
if (!peer->vRecvGetData.empty()) return true; if (!peer->m_getdata_requests.empty()) return true;
} }
{ {
@@ -3941,7 +3941,7 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
if (interruptMsgProc) return false; if (interruptMsgProc) return false;
{ {
LOCK(peer->m_getdata_requests_mutex); LOCK(peer->m_getdata_requests_mutex);
if (!peer->vRecvGetData.empty()) fMoreWork = true; if (!peer->m_getdata_requests.empty()) fMoreWork = true;
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' (%s) caught\n", __func__, SanitizeString(msg_type), nMessageSize, e.what(), typeid(e).name()); LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' (%s) caught\n", __func__, SanitizeString(msg_type), nMessageSize, e.what(), typeid(e).name());