bugfixes: added debug printout and added as service.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5243 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-06-21 23:52:39 +00:00
parent 7501d92882
commit 91b878fd61
2 changed files with 15 additions and 2 deletions

View File

@ -2243,6 +2243,7 @@ int RsServer::StartupRetroShare()
mBitDht->setupPeerSharer(mBanList);
p3BandwidthControl *mBwCtrl = new p3BandwidthControl(pqih);
pqih -> addService(mBwCtrl);
#ifdef RS_DSDVTEST
p3Dsdv *mDsdv = new p3Dsdv(mLinkMgr);

View File

@ -165,6 +165,8 @@ bool p3BandwidthControl::checkAvailableBandwidth()
rateMap.erase(it);
}
printRateInfo_locked(std::cerr);
/* any left over rateMaps ... are bad! (or not active - more likely) */
return true;
}
@ -264,12 +266,22 @@ int p3BandwidthControl::printRateInfo_locked(std::ostream &out)
out << std::endl;
//time_t now = time(NULL);
out << "Totals: ";
out << " In: " << mTotalRates.mRateIn;
out << " MaxIn: " << mTotalRates.mMaxRateIn;
out << " Out: " << mTotalRates.mRateOut;
out << " MaxOut: " << mTotalRates.mMaxRateOut;
out << std::endl;
std::map<std::string, BwCtrlData>::iterator bit;
for(bit = mBwMap.begin(); bit != mBwMap.end(); bit++)
{
//out << " Age: " << now - it->second.mTs;
//out << std::endl;
out << "\t" << bit->first;
out << " In: " << bit->second.mRates.mRateIn;
out << " MaxIn: " << bit->second.mRates.mMaxRateIn;
out << " Out: " << bit->second.mRates.mRateOut;
out << " MaxOut: " << bit->second.mRates.mMaxRateOut;
out << std::endl;
}
return true ;
}