aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-06-16 16:27:34 -0400
committerJohn Newbery <john@johnnewbery.com>2021-04-30 11:29:16 +0100
commit09cc66c00e1d5fabe11ffcc32cad060e6b483b20 (patch)
treeac6007f04168fa4ebfc2e21d68e68f49c08df2fc /src/net_processing.cpp
parent76568a3351418c878d30ba0373cf76988f93f90e (diff)
scripted-diff: rename address relay fields
-BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren fGetAddr m_getaddr_sent ren fSentAddr m_getaddr_recvd ren vAddrToSend m_addrs_to_send -END VERIFY SCRIPT-
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 543f58b5e5..f2e2a4dbe1 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -213,12 +213,12 @@ struct Peer {
std::atomic<bool> m_ping_queued{false};
/** A vector of addresses to send to the peer, limited to MAX_ADDR_TO_SEND. */
- std::vector<CAddress> vAddrToSend;
+ std::vector<CAddress> m_addrs_to_send;
/** Probabilistic filter of addresses that this peer already knows.
* Used to avoid relaying addresses to this peer more than once. */
const std::unique_ptr<CRollingBloomFilter> m_addr_known;
/** Whether a getaddr request to this peer is outstanding. */
- bool fGetAddr{false};
+ bool m_getaddr_sent{false};
/** Guards address sending timers. */
mutable Mutex m_addr_send_times_mutex;
/** Time point to send the next ADDR message to this peer. */
@@ -229,7 +229,7 @@ struct Peer {
* messages, indicating a preference to receive ADDRv2 instead of ADDR ones. */
std::atomic_bool m_wants_addrv2{false};
/** Whether this peer has already sent us a getaddr message. */
- bool fSentAddr{false};
+ bool m_getaddr_recvd{false};
/** Set of txids to reconsider once their parent transactions have been accepted **/
std::set<uint256> m_orphan_work_set GUARDED_BY(g_cs_orphans);
@@ -678,10 +678,10 @@ static void PushAddress(Peer& peer, const CAddress& addr, FastRandomContext& ins
// added after addresses were pushed.
assert(peer.m_addr_known);
if (addr.IsValid() && !peer.m_addr_known->contains(addr.GetKey()) && IsAddrCompatible(peer, addr)) {
- if (peer.vAddrToSend.size() >= MAX_ADDR_TO_SEND) {
- peer.vAddrToSend[insecure_rand.randrange(peer.vAddrToSend.size())] = addr;
+ if (peer.m_addrs_to_send.size() >= MAX_ADDR_TO_SEND) {
+ peer.m_addrs_to_send[insecure_rand.randrange(peer.m_addrs_to_send.size())] = addr;
} else {
- peer.vAddrToSend.push_back(addr);
+ peer.m_addrs_to_send.push_back(addr);
}
}
}
@@ -2527,7 +2527,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
// Get recent addresses
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make(NetMsgType::GETADDR));
- peer->fGetAddr = true;
+ peer->m_getaddr_sent = true;
}
if (!pfrom.IsInboundConn()) {
@@ -2741,7 +2741,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
continue;
}
bool fReachable = IsReachable(addr);
- if (addr.nTime > nSince && !peer->fGetAddr && vAddr.size() <= 10 && addr.IsRoutable()) {
+ if (addr.nTime > nSince && !peer->m_getaddr_sent && vAddr.size() <= 10 && addr.IsRoutable()) {
// Relay to a limited number of other nodes
RelayAddress(pfrom.GetId(), addr, fReachable);
}
@@ -2750,7 +2750,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
vAddrOk.push_back(addr);
}
m_addrman.Add(vAddrOk, pfrom.addr, 2 * 60 * 60);
- if (vAddr.size() < 1000) peer->fGetAddr = false;
+ if (vAddr.size() < 1000) peer->m_getaddr_sent = false;
if (pfrom.IsAddrFetchConn()) {
LogPrint(BCLog::NET, "addrfetch connection completed peer=%d; disconnecting\n", pfrom.GetId());
pfrom.fDisconnect = true;
@@ -3632,13 +3632,13 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
// Only send one GetAddr response per connection to reduce resource waste
// and discourage addr stamping of INV announcements.
- if (peer->fSentAddr) {
+ if (peer->m_getaddr_recvd) {
LogPrint(BCLog::NET, "Ignoring repeated \"getaddr\". peer=%d\n", pfrom.GetId());
return;
}
- peer->fSentAddr = true;
+ peer->m_getaddr_recvd = true;
- peer->vAddrToSend.clear();
+ peer->m_addrs_to_send.clear();
std::vector<CAddress> vAddr;
if (pfrom.HasPermission(PF_ADDR)) {
vAddr = m_connman.GetAddresses(MAX_ADDR_TO_SEND, MAX_PCT_ADDR_TO_SEND);
@@ -4235,10 +4235,10 @@ void PeerManagerImpl::MaybeSendAddr(CNode& node, Peer& peer, std::chrono::micros
peer.m_next_addr_send = PoissonNextSend(current_time, AVG_ADDRESS_BROADCAST_INTERVAL);
- if (!Assume(peer.vAddrToSend.size() <= MAX_ADDR_TO_SEND)) {
+ if (!Assume(peer.m_addrs_to_send.size() <= MAX_ADDR_TO_SEND)) {
// Should be impossible since we always check size before adding to
- // vAddrToSend. Recover by trimming the vector.
- peer.vAddrToSend.resize(MAX_ADDR_TO_SEND);
+ // m_addrs_to_send. Recover by trimming the vector.
+ peer.m_addrs_to_send.resize(MAX_ADDR_TO_SEND);
}
// Remove addr records that the peer already knows about, and add new
@@ -4248,11 +4248,11 @@ void PeerManagerImpl::MaybeSendAddr(CNode& node, Peer& peer, std::chrono::micros
if (!ret) peer.m_addr_known->insert(addr.GetKey());
return ret;
};
- peer.vAddrToSend.erase(std::remove_if(peer.vAddrToSend.begin(), peer.vAddrToSend.end(), addr_already_known),
- peer.vAddrToSend.end());
+ peer.m_addrs_to_send.erase(std::remove_if(peer.m_addrs_to_send.begin(), peer.m_addrs_to_send.end(), addr_already_known),
+ peer.m_addrs_to_send.end());
// No addr messages to send
- if (peer.vAddrToSend.empty()) return;
+ if (peer.m_addrs_to_send.empty()) return;
const char* msg_type;
int make_flags;
@@ -4263,12 +4263,12 @@ void PeerManagerImpl::MaybeSendAddr(CNode& node, Peer& peer, std::chrono::micros
msg_type = NetMsgType::ADDR;
make_flags = 0;
}
- m_connman.PushMessage(&node, CNetMsgMaker(node.GetCommonVersion()).Make(make_flags, msg_type, peer.vAddrToSend));
- peer.vAddrToSend.clear();
+ m_connman.PushMessage(&node, CNetMsgMaker(node.GetCommonVersion()).Make(make_flags, msg_type, peer.m_addrs_to_send));
+ peer.m_addrs_to_send.clear();
// we only send the big addr message once
- if (peer.vAddrToSend.capacity() > 40) {
- peer.vAddrToSend.shrink_to_fit();
+ if (peer.m_addrs_to_send.capacity() > 40) {
+ peer.m_addrs_to_send.shrink_to_fit();
}
}