mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
net: Allow connecting to extra outbound peers
This commit is contained in:
18
src/net.h
18
src/net.h
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user