Implement basic low water connection policy.

This commit is contained in:
Arthur Britto
2012-05-01 00:36:42 -07:00
parent 785f9b056a
commit 43ac5f8023
5 changed files with 121 additions and 23 deletions

View File

@@ -17,6 +17,7 @@ private:
boost::mutex mPeerLock;
typedef std::pair<NewcoinAddress, Peer::pointer> naPeer;
typedef std::pair<ipPort, Peer::pointer> pipPeer;
// Peers we are connecting with and non-thin peers we are connected to.
boost::unordered_map<ipPort, Peer::pointer> mIpMap;
@@ -33,6 +34,11 @@ private:
void scanHandler(const boost::system::error_code& ecResult);
// Peers we are establishing a connection with as a client.
// int miConnectStarting;
bool peerAvailable(std::string& strIp, int& iPort);
public:
ConnectionPool(boost::asio::io_service& io_service);
@@ -73,6 +79,12 @@ public:
void scanRefresh();
//
// Connection policy
//
void policyLowWater();
void policyEnforce();
#if 0
//std::vector<std::pair<PackedMessage::pointer,int> > mBroadcastMessages;