More cluster status work.

This commit is contained in:
JoelKatz
2013-07-10 11:58:53 -07:00
parent b135ca2fee
commit ea7730a419
5 changed files with 49 additions and 19 deletions

View File

@@ -342,6 +342,35 @@ public:
//--------------------------------------------------------------------------
uint32 getClusterFee ()
{
uint64 totFee = 0;
int totCount = 0;
int thresh = getApp().getOPs().getNetworkTimeNC();
if (thresh <= 120)
thresh = 1;
else
thresh -= 120;
boost::recursive_mutex::scoped_lock sl (mUNLLock);
{
for (std::map<RippleAddress, ClusterNodeStatus>::iterator it = m_clusterNodes.begin(),
end = m_clusterNodes.end(); it != end; ++it)
{
if (it->second.getReportTime() >= thresh)
{
++totCount;
totFee += it->second.getLoadFee();
}
}
}
return (totCount == 0) ? 0 : static_cast<uint32>(totFee / totCount);
}
//--------------------------------------------------------------------------
void nodeBootstrap ()
{
int iDomains = 0;