Refactor ConnectionPool into IPeers and hide the implementation

Conflicts:
	src/cpp/ripple/Application.h
This commit is contained in:
Vinnie Falco
2013-06-05 10:58:23 -07:00
parent d8c97c2149
commit eb57573f9a
18 changed files with 363 additions and 310 deletions

View File

@@ -302,7 +302,7 @@ void NetworkOPs::runTransactionQueue()
tx.set_receivetimestamp(getNetworkTimeNC()); // FIXME: This should be when we received it
PackedMessage::pointer packet = boost::make_shared<PackedMessage>(tx, ripple::mtTRANSACTION);
theApp->getConnectionPool().relayMessageBut(peers, packet);
theApp->getPeers().relayMessageBut(peers, packet);
}
}
@@ -402,7 +402,7 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
tx.set_receivetimestamp(getNetworkTimeNC()); // FIXME: This should be when we received it
PackedMessage::pointer packet = boost::make_shared<PackedMessage>(tx, ripple::mtTRANSACTION);
theApp->getConnectionPool().relayMessageBut(peers, packet);
theApp->getPeers().relayMessageBut(peers, packet);
}
}
@@ -601,7 +601,7 @@ void NetworkOPs::checkState(const boost::system::error_code& result)
theApp->getLoadManager().noDeadLock();
std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector();
std::vector<Peer::pointer> peerList = theApp->getPeers().getPeerVector();
// do we have sufficient peers? If not, we are disconnected.
if (peerList.size() < theConfig.NETWORK_QUORUM)
@@ -639,7 +639,7 @@ void NetworkOPs::checkState(const boost::system::error_code& result)
void NetworkOPs::tryStartConsensus()
{
uint256 networkClosed;
bool ledgerChange = checkLastClosedLedger(theApp->getConnectionPool().getPeerVector(), networkClosed);
bool ledgerChange = checkLastClosedLedger(theApp->getPeers().getPeerVector(), networkClosed);
if (networkClosed.isZero())
return;
@@ -822,7 +822,7 @@ void NetworkOPs::switchLastClosedLedger(Ledger::pointer newLedger, bool duringCo
hash = newLedger->getHash();
s.set_ledgerhash(hash.begin(), hash.size());
PackedMessage::pointer packet = boost::make_shared<PackedMessage>(s, ripple::mtSTATUS_CHANGE);
theApp->getConnectionPool().relayMessage(NULL, packet);
theApp->getPeers().relayMessage(NULL, packet);
}
int NetworkOPs::beginConsensus(const uint256& networkClosed, Ledger::pointer closingLedger)
@@ -865,7 +865,7 @@ bool NetworkOPs::haveConsensusObject()
else
{ // we need to get into the consensus process
uint256 networkClosed;
std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector();
std::vector<Peer::pointer> peerList = theApp->getPeers().getPeerVector();
bool ledgerChange = checkLastClosedLedger(peerList, networkClosed);
if (!ledgerChange)
{
@@ -923,7 +923,7 @@ void NetworkOPs::processTrustedProposal(LedgerProposal::pointer proposal,
std::set<uint64> peers;
theApp->getHashRouter().swapSet(proposal->getHashRouter(), peers, SF_RELAYED);
PackedMessage::pointer message = boost::make_shared<PackedMessage>(*set, ripple::mtPROPOSE_LEDGER);
theApp->getConnectionPool().relayMessageBut(peers, message);
theApp->getPeers().relayMessageBut(peers, message);
}
else
WriteLog (lsINFO, NetworkOPs) << "Not relaying trusted proposal";
@@ -994,7 +994,7 @@ void NetworkOPs::mapComplete(const uint256& hash, SHAMap::ref map)
void NetworkOPs::endConsensus(bool correctLCL)
{
uint256 deadLedger = mLedgerMaster->getClosedLedger()->getParentHash();
std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector();
std::vector<Peer::pointer> peerList = theApp->getPeers().getPeerVector();
BOOST_FOREACH(Peer::ref it, peerList)
if (it && (it->getClosedLedgerHash() == deadLedger))
{
@@ -1282,7 +1282,7 @@ Json::Value NetworkOPs::getServerInfo(bool human, bool admin)
if (fp != 0)
info["fetch_pack"] = Json::UInt(fp);
info["peers"] = theApp->getConnectionPool().getPeerCount();
info["peers"] = theApp->getPeers().getPeerCount();
Json::Value lastClose = Json::objectValue;
lastClose["proposers"] = theApp->getOPs().getPreviousProposers();