From 3dbee6e4611c8b408521bdb1efe658dc60a20eb8 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 3 May 2012 13:38:50 -0700 Subject: [PATCH] getPeerVector function. --- src/ConnectionPool.cpp | 13 +++++++++++++ src/ConnectionPool.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/ConnectionPool.cpp b/src/ConnectionPool.cpp index 88f3adb4d..f1b66b65f 100644 --- a/src/ConnectionPool.cpp +++ b/src/ConnectionPool.cpp @@ -215,6 +215,19 @@ Json::Value ConnectionPool::getPeersJson() return ret; } +std::vector ConnectionPool::getPeerVector() +{ + std::vector ret; + ret.resize(mConnectedMap.size()); + + BOOST_FOREACH(naPeer pair, mConnectedMap) + { + ret.push_back(pair.second); + } + + return ret; +} + // Now know peer's node public key. Determine if we want to stay connected. bool ConnectionPool::peerConnected(Peer::pointer peer, const NewcoinAddress& na) { diff --git a/src/ConnectionPool.h b/src/ConnectionPool.h index 6404b6482..7d5f4a986 100644 --- a/src/ConnectionPool.h +++ b/src/ConnectionPool.h @@ -72,6 +72,7 @@ public: void peerFailed(const std::string& strIp, int iPort); Json::Value getPeersJson(); + std::vector getPeerVector(); // // Scanning