Use NewcoingAddress in mConnectionPool.

This commit is contained in:
Arthur Britto
2012-04-26 15:21:02 -07:00
parent a014ef63b4
commit f761d826cf
2 changed files with 4 additions and 5 deletions

View File

@@ -122,10 +122,9 @@ void ConnectionPool::peerDisconnected(Peer::pointer peer)
// XXX Don't access member variable directly. // XXX Don't access member variable directly.
if (peer->mPublicKey.isValid()) if (peer->mPublicKey.isValid())
{ {
// XXX Would be better if NewcoinAddress had a hash function. boost::unordered_map<NewcoinAddress, Peer::pointer>::iterator itCm;
boost::unordered_map<std::vector<unsigned char>, Peer::pointer>::iterator itCm;
itCm = mConnectedMap.find(peer->mPublicKey.getNodePublic()); itCm = mConnectedMap.find(peer->mPublicKey);
if (itCm == mConnectedMap.end()) if (itCm == mConnectedMap.end())
{ {

View File

@@ -15,7 +15,7 @@ class ConnectionPool
private: private:
boost::mutex mPeerLock; boost::mutex mPeerLock;
typedef std::pair<std::vector<unsigned char>, Peer::pointer> naPeer; typedef std::pair<NewcoinAddress, Peer::pointer> naPeer;
// Count of peers we are in progress of connecting to. // Count of peers we are in progress of connecting to.
// We are in progress until we know their network public key. // We are in progress until we know their network public key.
@@ -25,7 +25,7 @@ private:
boost::unordered_map<ipPort, Peer::pointer> mIpMap; boost::unordered_map<ipPort, Peer::pointer> mIpMap;
// Non-thin peers which we are connected to. // Non-thin peers which we are connected to.
boost::unordered_map<std::vector<unsigned char>, Peer::pointer> mConnectedMap; boost::unordered_map<NewcoinAddress, Peer::pointer> mConnectedMap;
public: public:
ConnectionPool(); ConnectionPool();