diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2017-10-23 13:36:15 -0400 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2017-11-01 13:13:43 -0400 |
commit | 2d4327db1973a354e9e4153de6958d49120fcde8 (patch) | |
tree | 2f31c4deb1facd3378b84467e3e1ddbca3a51da9 /src/net.h | |
parent | ba216b5fa63e7e6cae847d1e3621f5c54840f898 (diff) |
net: Allow connecting to extra outbound peers
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -251,6 +251,19 @@ public: void GetBanned(banmap_t &banmap); void SetBanned(const banmap_t &banmap); + // This allows temporarily exceeding nMaxOutbound, with the goal of finding + // a peer that is better than all our current peers. + void SetTryNewOutboundPeer(bool flag); + bool GetTryNewOutboundPeer(); + + // Return the number of outbound peers we have in excess of our target (eg, + // if we previously called SetTryNewOutboundPeer(true), and have since set + // to false, we may have extra peers that we wish to disconnect). This may + // return a value less than (num_outbound_connections - num_outbound_slots) + // in cases where some outbound connections are not yet fully connected, or + // not yet fully disconnected. + int GetExtraOutboundCount(); + bool AddNode(const std::string& node); bool RemoveAddedNode(const std::string& node); std::vector<AddedNodeInfo> GetAddedNodeInfo(); @@ -413,6 +426,11 @@ private: std::thread threadOpenAddedConnections; std::thread threadOpenConnections; std::thread threadMessageHandler; + + /** flag for deciding to connect to an extra outbound peer, + * in excess of nMaxOutbound + * This takes the place of a feeler connection */ + std::atomic_bool m_try_another_outbound_peer; }; extern std::unique_ptr<CConnman> g_connman; void Discover(boost::thread_group& threadGroup); |