Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | struct Options { | ||||
std::vector<std::string> m_specified_outgoing; | std::vector<std::string> m_specified_outgoing; | ||||
std::vector<std::string> m_added_nodes; | std::vector<std::string> m_added_nodes; | ||||
std::vector<bool> m_asmap; | std::vector<bool> m_asmap; | ||||
}; | }; | ||||
void Init(const Options &connOptions) { | void Init(const Options &connOptions) { | ||||
nLocalServices = connOptions.nLocalServices; | nLocalServices = connOptions.nLocalServices; | ||||
nMaxConnections = connOptions.nMaxConnections; | nMaxConnections = connOptions.nMaxConnections; | ||||
m_max_outbound_full_relay = std::min( | |||||
connOptions.m_max_outbound_full_relay, connOptions.nMaxConnections); | |||||
m_max_outbound_block_relay = connOptions.m_max_outbound_block_relay; | |||||
m_use_addrman_outgoing = connOptions.m_use_addrman_outgoing; | m_use_addrman_outgoing = connOptions.m_use_addrman_outgoing; | ||||
nMaxAddnode = connOptions.nMaxAddnode; | nMaxAddnode = connOptions.nMaxAddnode; | ||||
nMaxFeeler = connOptions.nMaxFeeler; | nMaxFeeler = connOptions.nMaxFeeler; | ||||
m_max_outbound = | { | ||||
m_max_outbound_full_relay + m_max_outbound_block_relay + nMaxFeeler; | LOCK(cs_maxOutboundPeers); | ||||
m_max_outbound_full_relay = | |||||
std::min(connOptions.m_max_outbound_full_relay, | |||||
connOptions.nMaxConnections); | |||||
m_max_outbound_block_relay = connOptions.m_max_outbound_block_relay; | |||||
m_max_outbound = m_max_outbound_full_relay + | |||||
m_max_outbound_block_relay + nMaxFeeler; | |||||
} | |||||
nBestHeight = connOptions.nBestHeight; | nBestHeight = connOptions.nBestHeight; | ||||
clientInterface = connOptions.uiInterface; | clientInterface = connOptions.uiInterface; | ||||
m_banman = connOptions.m_banman; | m_banman = connOptions.m_banman; | ||||
m_msgproc = connOptions.m_msgproc; | m_msgproc = connOptions.m_msgproc; | ||||
nSendBufferMaxSize = connOptions.nSendBufferMaxSize; | nSendBufferMaxSize = connOptions.nSendBufferMaxSize; | ||||
nReceiveFloodSize = connOptions.nReceiveFloodSize; | nReceiveFloodSize = connOptions.nReceiveFloodSize; | ||||
m_peer_connect_timeout = connOptions.m_peer_connect_timeout; | m_peer_connect_timeout = connOptions.m_peer_connect_timeout; | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | private: | ||||
* \sa CNode::nLocalServices | * \sa CNode::nLocalServices | ||||
*/ | */ | ||||
ServiceFlags nLocalServices; | ServiceFlags nLocalServices; | ||||
std::unique_ptr<CSemaphore> semOutbound; | std::unique_ptr<CSemaphore> semOutbound; | ||||
std::unique_ptr<CSemaphore> semAddnode; | std::unique_ptr<CSemaphore> semAddnode; | ||||
int nMaxConnections; | int nMaxConnections; | ||||
RecursiveMutex cs_maxOutboundPeers; | |||||
// How many full-relay (tx, block, addr) outbound peers we want | // How many full-relay (tx, block, addr) outbound peers we want | ||||
int m_max_outbound_full_relay; | int m_max_outbound_full_relay GUARDED_BY(cs_maxOutboundPeers); | ||||
// How many block-relay only outbound peers we want | // How many block-relay only outbound peers we want | ||||
// We do not relay tx or addr messages with these peers | // We do not relay tx or addr messages with these peers | ||||
int m_max_outbound_block_relay; | int m_max_outbound_block_relay GUARDED_BY(cs_maxOutboundPeers); | ||||
int nMaxAddnode; | int nMaxAddnode; | ||||
int nMaxFeeler; | int nMaxFeeler; | ||||
int m_max_outbound; | int m_max_outbound; | ||||
bool m_use_addrman_outgoing; | bool m_use_addrman_outgoing; | ||||
std::atomic<int> nBestHeight; | std::atomic<int> nBestHeight; | ||||
CClientUIInterface *clientInterface; | CClientUIInterface *clientInterface; | ||||
NetEventsInterface *m_msgproc; | NetEventsInterface *m_msgproc; | ||||
▲ Show 20 Lines • Show All 585 Lines • Show Last 20 Lines |