aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2019-03-08 15:30:36 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2019-08-28 13:41:58 -0400
commitc4aa2ba82211ea5988ed7fe21e1b08bc3367e6d4 (patch)
treef0666a205ae658352be324c48aac5507110c7ab6 /src/net.cpp
parent4de0dbac9b286c42a9b10132b7c2d76712f1a319 (diff)
[refactor] Change tx_relay structure to be unique_ptr
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 527c001308..78b33954d6 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -500,8 +500,8 @@ void CNode::copyStats(CNodeStats &stats)
X(addr);
X(addrBind);
{
- LOCK(m_tx_relay.cs_filter);
- stats.fRelayTxes = m_tx_relay.fRelayTxes;
+ LOCK(m_tx_relay->cs_filter);
+ stats.fRelayTxes = m_tx_relay->fRelayTxes;
}
X(nLastSend);
X(nLastRecv);
@@ -529,8 +529,8 @@ void CNode::copyStats(CNodeStats &stats)
X(m_legacyWhitelisted);
X(m_permissionFlags);
{
- LOCK(m_tx_relay.cs_feeFilter);
- stats.minFeeFilter = m_tx_relay.minFeeFilter;
+ LOCK(m_tx_relay->cs_feeFilter);
+ stats.minFeeFilter = m_tx_relay->minFeeFilter;
}
// It is common for nodes with good ping times to suddenly become lagged,
@@ -818,11 +818,11 @@ bool CConnman::AttemptToEvictConnection()
continue;
if (node->fDisconnect)
continue;
- LOCK(node->m_tx_relay.cs_filter);
+ LOCK(node->m_tx_relay->cs_filter);
NodeEvictionCandidate candidate = {node->GetId(), node->nTimeConnected, node->nMinPingUsecTime,
node->nLastBlockTime, node->nLastTXTime,
HasAllDesirableServiceFlags(node->nServices),
- node->m_tx_relay.fRelayTxes, node->m_tx_relay.pfilter != nullptr, node->addr, node->nKeyedNetGroup,
+ node->m_tx_relay->fRelayTxes, node->m_tx_relay->pfilter != nullptr, node->addr, node->nKeyedNetGroup,
node->m_prefer_evict};
vEvictionCandidates.push_back(candidate);
}
@@ -2633,6 +2633,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
hSocket = hSocketIn;
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
hashContinue = uint256();
+ m_tx_relay = MakeUnique<TxRelay>();
for (const std::string &msg : getAllNetMessageTypes())
mapRecvBytesPerMsgCmd[msg] = 0;