Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 1,784 Lines • ▼ Show 20 Lines | for (const std::string &seed : seeds) { | ||||
to_wait -= w; | to_wait -= w; | ||||
int nRelevant = 0; | int nRelevant = 0; | ||||
{ | { | ||||
LOCK(cs_vNodes); | LOCK(cs_vNodes); | ||||
for (const CNode *pnode : vNodes) { | for (const CNode *pnode : vNodes) { | ||||
nRelevant += pnode->fSuccessfullyConnected && | nRelevant += pnode->fSuccessfullyConnected && | ||||
!pnode->IsFeelerConn() && | !pnode->IsFeelerConn() && | ||||
!pnode->m_addr_fetch && | !pnode->IsAddrFetchConn() && | ||||
!pnode->IsManualConn() && | !pnode->IsManualConn() && | ||||
!pnode->fInbound; | !pnode->fInbound; | ||||
} | } | ||||
} | } | ||||
if (nRelevant >= 2) { | if (nRelevant >= 2) { | ||||
if (found > 0) { | if (found > 0) { | ||||
LogPrintf("%d addresses found from DNS seeds\n", | LogPrintf("%d addresses found from DNS seeds\n", | ||||
found); | found); | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
// some peer that has finished the handshake). | // some peer that has finished the handshake). | ||||
int CConnman::GetExtraOutboundCount() { | int CConnman::GetExtraOutboundCount() { | ||||
int nOutbound = 0; | int nOutbound = 0; | ||||
{ | { | ||||
LOCK(cs_vNodes); | LOCK(cs_vNodes); | ||||
for (const CNode *pnode : vNodes) { | for (const CNode *pnode : vNodes) { | ||||
if (!pnode->fInbound && !pnode->IsManualConn() && | if (!pnode->fInbound && !pnode->IsManualConn() && | ||||
!pnode->IsFeelerConn() && !pnode->fDisconnect && | !pnode->IsFeelerConn() && !pnode->fDisconnect && | ||||
!pnode->m_addr_fetch && pnode->fSuccessfullyConnected) { | !pnode->IsAddrFetchConn() && pnode->fSuccessfullyConnected) { | ||||
++nOutbound; | ++nOutbound; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return std::max( | return std::max( | ||||
nOutbound - m_max_outbound_full_relay - m_max_outbound_block_relay, 0); | nOutbound - m_max_outbound_full_relay - m_max_outbound_block_relay, 0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,054 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, | CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, | ||||
int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, | int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, | ||||
uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, | uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, | ||||
const CAddress &addrBindIn, const std::string &addrNameIn, | const CAddress &addrBindIn, const std::string &addrNameIn, | ||||
ConnectionType conn_type_in) | ConnectionType conn_type_in) | ||||
: nTimeConnected(GetSystemTimeInSeconds()), addr(addrIn), | : nTimeConnected(GetSystemTimeInSeconds()), addr(addrIn), | ||||
addrBind(addrBindIn), | addrBind(addrBindIn), fInbound(conn_type_in == ConnectionType::INBOUND), | ||||
m_addr_fetch(conn_type_in == ConnectionType::ADDR_FETCH), | |||||
fInbound(conn_type_in == ConnectionType::INBOUND), | |||||
nKeyedNetGroup(nKeyedNetGroupIn), | nKeyedNetGroup(nKeyedNetGroupIn), | ||||
// Don't relay addr messages to peers that we connect to as | // Don't relay addr messages to peers that we connect to as | ||||
// block-relay-only peers (to prevent adversaries from inferring these | // block-relay-only peers (to prevent adversaries from inferring these | ||||
// links from addr traffic). | // links from addr traffic). | ||||
id(idIn), nLocalHostNonce(nLocalHostNonceIn), m_conn_type(conn_type_in), | id(idIn), nLocalHostNonce(nLocalHostNonceIn), m_conn_type(conn_type_in), | ||||
nLocalServices(nLocalServicesIn), nMyStartingHeight(nMyStartingHeightIn) { | nLocalServices(nLocalServicesIn), nMyStartingHeight(nMyStartingHeightIn) { | ||||
hSocket = hSocketIn; | hSocket = hSocketIn; | ||||
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; | addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; | ||||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |