Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | void Init(const Options &connOptions) { | ||||
nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe; | nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe; | ||||
nMaxOutboundLimit = connOptions.nMaxOutboundLimit; | nMaxOutboundLimit = connOptions.nMaxOutboundLimit; | ||||
} | } | ||||
vWhitelistedRange = connOptions.vWhitelistedRange; | vWhitelistedRange = connOptions.vWhitelistedRange; | ||||
{ | { | ||||
LOCK(cs_vAddedNodes); | LOCK(cs_vAddedNodes); | ||||
vAddedNodes = connOptions.m_added_nodes; | vAddedNodes = connOptions.m_added_nodes; | ||||
} | } | ||||
m_onion_binds = connOptions.onion_binds; | |||||
} | } | ||||
CConnman(const Config &configIn, uint64_t seed0, uint64_t seed1, | CConnman(const Config &configIn, uint64_t seed0, uint64_t seed1, | ||||
bool network_active = true); | bool network_active = true); | ||||
~CConnman(); | ~CConnman(); | ||||
bool Start(CScheduler &scheduler, const Options &options); | bool Start(CScheduler &scheduler, const Options &options); | ||||
▲ Show 20 Lines • Show All 341 Lines • ▼ Show 20 Lines | private: | ||||
/** | /** | ||||
* flag for deciding to connect to an extra outbound peer, in excess of | * flag for deciding to connect to an extra outbound peer, in excess of | ||||
* m_max_outbound_full_relay. This takes the place of a feeler connection. | * m_max_outbound_full_relay. This takes the place of a feeler connection. | ||||
*/ | */ | ||||
std::atomic_bool m_try_another_outbound_peer; | std::atomic_bool m_try_another_outbound_peer; | ||||
std::atomic<int64_t> m_next_send_inv_to_incoming{0}; | std::atomic<int64_t> m_next_send_inv_to_incoming{0}; | ||||
/** | |||||
* A vector of -bind=<address>:<port>=onion arguments each of which is | |||||
* an address and port that are designated for incoming Tor connections. | |||||
*/ | |||||
std::vector<CService> m_onion_binds; | |||||
friend struct ::CConnmanTest; | friend struct ::CConnmanTest; | ||||
friend struct ConnmanTestMsg; | friend struct ConnmanTestMsg; | ||||
}; | }; | ||||
void Discover(); | void Discover(); | ||||
void StartMapPort(); | void StartMapPort(); | ||||
void InterruptMapPort(); | void InterruptMapPort(); | ||||
void StopMapPort(); | void StopMapPort(); | ||||
▲ Show 20 Lines • Show All 544 Lines • ▼ Show 20 Lines | public: | ||||
std::atomic<bool> fPingQueued{false}; | std::atomic<bool> fPingQueued{false}; | ||||
std::set<TxId> orphan_work_set; | std::set<TxId> orphan_work_set; | ||||
CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, | CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, | ||||
SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, | SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, | ||||
uint64_t nLocalHostNonceIn, uint64_t nLocalExtraEntropyIn, | uint64_t nLocalHostNonceIn, uint64_t nLocalExtraEntropyIn, | ||||
const CAddress &addrBindIn, const std::string &addrNameIn, | const CAddress &addrBindIn, const std::string &addrNameIn, | ||||
ConnectionType conn_type_in); | ConnectionType conn_type_in, bool inbound_onion = false); | ||||
~CNode(); | ~CNode(); | ||||
CNode(const CNode &) = delete; | CNode(const CNode &) = delete; | ||||
CNode &operator=(const CNode &) = delete; | CNode &operator=(const CNode &) = delete; | ||||
private: | private: | ||||
const NodeId id; | const NodeId id; | ||||
const uint64_t nLocalHostNonce; | const uint64_t nLocalHostNonce; | ||||
const uint64_t nLocalExtraEntropy; | const uint64_t nLocalExtraEntropy; | ||||
Show All 24 Lines | private: | ||||
mutable RecursiveMutex cs_addrName; | mutable RecursiveMutex cs_addrName; | ||||
std::string addrName GUARDED_BY(cs_addrName); | std::string addrName GUARDED_BY(cs_addrName); | ||||
// Our address, as reported by the peer | // Our address, as reported by the peer | ||||
CService addrLocal GUARDED_BY(cs_addrLocal); | CService addrLocal GUARDED_BY(cs_addrLocal); | ||||
mutable RecursiveMutex cs_addrLocal; | mutable RecursiveMutex cs_addrLocal; | ||||
//! Whether this peer connected via our Tor onion service. | |||||
const bool m_inbound_onion{false}; | |||||
public: | public: | ||||
NodeId GetId() const { return id; } | NodeId GetId() const { return id; } | ||||
uint64_t GetLocalNonce() const { return nLocalHostNonce; } | uint64_t GetLocalNonce() const { return nLocalHostNonce; } | ||||
uint64_t GetLocalExtraEntropy() const { return nLocalExtraEntropy; } | uint64_t GetLocalExtraEntropy() const { return nLocalExtraEntropy; } | ||||
int GetMyStartingHeight() const { return nMyStartingHeight; } | int GetMyStartingHeight() const { return nMyStartingHeight; } | ||||
▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines |