Simply getPeersJson and display connection source.

This commit is contained in:
Arthur Britto
2012-06-14 19:06:09 -07:00
parent a7e4523b64
commit 0b60693c7a
2 changed files with 10 additions and 15 deletions

View File

@@ -248,16 +248,12 @@ bool ConnectionPool::connectTo(const std::string& strIp, int iPort)
Json::Value ConnectionPool::getPeersJson()
{
Json::Value ret(Json::arrayValue);
Json::Value ret(Json::arrayValue);
std::vector<Peer::pointer> vppPeers = getPeerVector();
boost::mutex::scoped_lock sl(mPeerLock);
BOOST_FOREACH(naPeer pair, mConnectedMap)
BOOST_FOREACH(Peer::pointer peer, vppPeers)
{
Peer::pointer peer = pair.second;
if (!peer)
std::cerr << "CP::GPH null peer" << std::endl;
else ret.append(peer->getJson());
ret.append(peer->getJson());
}
return ret;
@@ -285,7 +281,9 @@ bool ConnectionPool::peerConnected(Peer::pointer peer, const NewcoinAddress& na)
{
bool bSuccess;
std::cerr << "ConnectionPool::peerConnected: " << na.humanNodePublic() << std::endl;
std::cerr << "ConnectionPool::peerConnected: " << na.humanNodePublic()
<< " " << peer->getIP() << " " << peer->getPort()
<< std::endl;
assert(!!peer);
if (na == theApp->getWallet().getNodePublic())
{