diff --git a/src/ConnectionPool.cpp b/src/ConnectionPool.cpp index b57681452..931fe93e2 100644 --- a/src/ConnectionPool.cpp +++ b/src/ConnectionPool.cpp @@ -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 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()) { diff --git a/src/Peer.h b/src/Peer.h index 82eb997e7..959876915 100644 --- a/src/Peer.h +++ b/src/Peer.h @@ -14,9 +14,9 @@ enum PeerPunish { - PP_INVALID_REQUEST = 1, // The peer sent a request that makes no sense - PP_UNKNOWN_REQUEST = 2, // The peer sent a request that might be garbage - PP_UNWANTED_DATA = 3, // The peer sent us data we didn't want/need + PP_INVALID_REQUEST = 1, // The peer sent a request that makes no sense + PP_UNKNOWN_REQUEST = 2, // The peer sent a request that might be garbage + PP_UNWANTED_DATA = 3, // The peer sent us data we didn't want/need }; typedef std::pair ipPort; @@ -56,10 +56,7 @@ protected: Peer(boost::asio::io_service& io_service, boost::asio::ssl::context& ctx); - - void handle_write(const boost::system::error_code& error, size_t bytes_transferred); - //void handle_read(const boost::system::error_code& error, size_t bytes_transferred); void handle_read_header(const boost::system::error_code& error); void handle_read_body(const boost::system::error_code& error); void processReadBuffer();