Remove unused functions and clean up some comments

This commit is contained in:
Vinnie Falco
2013-06-11 13:13:31 -07:00
parent e3d844de8f
commit a70ede6cae
12 changed files with 72 additions and 60 deletions

View File

@@ -971,16 +971,21 @@ void NetworkOPs::mapComplete(uint256 const& hash, SHAMap::ref map)
mConsensus->mapComplete(hash, map, true);
}
void NetworkOPs::endConsensus(bool correctLCL)
void NetworkOPs::endConsensus (bool correctLCL)
{
uint256 deadLedger = mLedgerMaster->getClosedLedger()->getParentHash();
std::vector<Peer::pointer> peerList = theApp->getPeers().getPeerVector();
BOOST_FOREACH(Peer::ref it, peerList)
std::vector <Peer::pointer> peerList = theApp->getPeers().getPeerVector ();
BOOST_FOREACH(Peer::ref it, peerList)
{
if (it && (it->getClosedLedgerHash() == deadLedger))
{
WriteLog (lsTRACE, NetworkOPs) << "Killing obsolete peer status";
it->cycleStatus();
}
}
mConsensus = boost::shared_ptr<LedgerConsensus>();
}
@@ -990,33 +995,43 @@ void NetworkOPs::consensusViewChange()
setMode(omCONNECTED);
}
void NetworkOPs::pubServer()
void NetworkOPs::pubServer ()
{
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
// VFALCO TODO Don't hold the lock across calls to send...make a copy of the
// list into a local array while holding the lock then release the
// lock and call send on everyone.
//
boost::recursive_mutex::scoped_lock sl (mMonitorLock);
if (!mSubServer.empty())
{
Json::Value jvObj(Json::objectValue);
if (!mSubServer.empty ())
{
Json::Value jvObj (Json::objectValue);
jvObj["type"] = "serverStatus";
jvObj["server_status"] = strOperatingMode();
jvObj["load_base"] = (mLastLoadBase = theApp->getFeeTrack().getLoadBase());
jvObj["load_factor"] = (mLastLoadFactor = theApp->getFeeTrack().getLoadFactor());
jvObj ["type"] = "serverStatus";
jvObj ["server_status"] = strOperatingMode();
jvObj ["load_base"] = (mLastLoadBase = theApp->getFeeTrack().getLoadBase());
jvObj ["load_factor"] = (mLastLoadFactor = theApp->getFeeTrack().getLoadFactor());
NetworkOPs::subMapType::const_iterator it = mSubServer.begin();
while (it != mSubServer.end())
{
InfoSub::pointer p = it->second.lock();
if (p)
{
p->send(jvObj, true);
++it;
}
else
it = mSubServer.erase(it);
}
NetworkOPs::subMapType::const_iterator it = mSubServer.begin();
}
while (it != mSubServer.end())
{
InfoSub::pointer p = it->second.lock();
// VFALCO TODO research the possibility of using thread queues and linearizing
// the deletion of subscribers with the sending of JSON data.
if (p)
{
p->send(jvObj, true);
++it;
}
else
{
it = mSubServer.erase(it);
}
}
}
}
void NetworkOPs::setMode(OperatingMode om)
@@ -1662,9 +1677,11 @@ bool NetworkOPs::subBook(InfoSub::ref isrListener, const uint160& currencyPays,
{
BookListeners::pointer listeners =
theApp->getOrderBookDB().makeBookListeners(currencyPays, currencyGets, issuerPays, issuerGets);
if (listeners)
if (listeners)
listeners->addSubscriber(isrListener);
return true;
return true;
}
bool NetworkOPs::unsubBook(uint64 uSeq,