diff options
| author | Amiti Uttarwar <[email protected]> | 2020-06-02 08:39:47 -0700 |
|---|---|---|
| committer | Amiti Uttarwar <[email protected]> | 2020-08-07 17:18:16 -0700 |
| commit | 49efac5cae7333c6700d9b737d09fae0f3f4d7fa (patch) | |
| tree | bcc9a94b9bf862e83769cf34afe56ed396e0b456 /src/net_processing.cpp | |
| parent | [net/refactor] Add connection type as a member var to CNode (diff) | |
| download | discoin-49efac5cae7333c6700d9b737d09fae0f3f4d7fa.tar.xz discoin-49efac5cae7333c6700d9b737d09fae0f3f4d7fa.zip | |
[net/refactor] Remove m_manual_connection flag from CNode
Diffstat (limited to 'src/net_processing.cpp')
| -rw-r--r-- | src/net_processing.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ba30f7a7b..62886064e 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -827,11 +827,9 @@ void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds) if (state) state->m_last_block_announcement = time_in_seconds; } -// Returns true for outbound peers, excluding manual connections, feelers, and -// one-shots. static bool IsOutboundDisconnectionCandidate(const CNode& node) { - return !(node.fInbound || node.m_manual_connection || node.fFeeler || node.m_addr_fetch); + return !(node.fInbound || node.IsManualConn() || node.fFeeler || node.m_addr_fetch); } void PeerLogicValidation::InitializeNode(CNode *pnode) { @@ -840,7 +838,7 @@ void PeerLogicValidation::InitializeNode(CNode *pnode) { NodeId nodeid = pnode->GetId(); { LOCK(cs_main); - mapNodeState.emplace_hint(mapNodeState.end(), std::piecewise_construct, std::forward_as_tuple(nodeid), std::forward_as_tuple(addr, std::move(addrName), pnode->fInbound, pnode->m_manual_connection)); + mapNodeState.emplace_hint(mapNodeState.end(), std::piecewise_construct, std::forward_as_tuple(nodeid), std::forward_as_tuple(addr, std::move(addrName), pnode->fInbound, pnode->IsManualConn())); } if(!pnode->fInbound) PushNodeVersion(*pnode, *connman, GetTime()); @@ -2326,7 +2324,7 @@ void ProcessMessage( { connman.SetServices(pfrom.addr, nServices); } - if (!pfrom.fInbound && !pfrom.fFeeler && !pfrom.m_manual_connection && !HasAllDesirableServiceFlags(nServices)) + if (!pfrom.fInbound && !pfrom.fFeeler && !pfrom.IsManualConn() && !HasAllDesirableServiceFlags(nServices)) { LogPrint(BCLog::NET, "peer=%d does not offer the expected services (%08x offered, %08x expected); disconnecting\n", pfrom.GetId(), nServices, GetDesirableServiceFlags(nServices)); pfrom.fDisconnect = true; @@ -3736,7 +3734,7 @@ bool PeerLogicValidation::MaybeDiscourageAndDisconnect(CNode& pnode) return false; } - if (pnode.m_manual_connection) { + if (pnode.IsManualConn()) { // We never disconnect or discourage manual peers for bad behavior LogPrintf("Warning: not punishing manually connected peer %d!\n", peer_id); return false; |