mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-04 09:05:34 -05:00
Added QueueSize information to be exported too.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5245 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9fcc9277c2
commit
e0af833f47
@ -58,11 +58,13 @@ class RsBwRates
|
||||
{
|
||||
public:
|
||||
RsBwRates()
|
||||
:mRateIn(0), mRateOut(0), mMaxRateIn(0), mMaxRateOut(0) {return;}
|
||||
:mRateIn(0), mRateOut(0), mMaxRateIn(0), mMaxRateOut(0), mQueueIn(0), mQueueOut(0) {return;}
|
||||
float mRateIn;
|
||||
float mRateOut;
|
||||
float mMaxRateIn;
|
||||
float mMaxRateOut;
|
||||
int mQueueIn;
|
||||
int mQueueOut;
|
||||
};
|
||||
|
||||
|
||||
@ -86,6 +88,7 @@ virtual void getRates(RsBwRates &rates)
|
||||
return;
|
||||
}
|
||||
|
||||
virtual int getQueueSize(bool /* in */) { return 0;}
|
||||
virtual float getRate(bool in)
|
||||
{
|
||||
if (in)
|
||||
|
@ -742,6 +742,8 @@ int pqihandler::ExtractRates(std::map<std::string, RsBwRates> &ratemap, RsBw
|
||||
total.mMaxRateOut = getMaxRate(false);
|
||||
total.mRateIn = 0;
|
||||
total.mRateOut = 0;
|
||||
total.mQueueIn = 0;
|
||||
total.mQueueOut = 0;
|
||||
|
||||
/* Lock once rates have been retrieved */
|
||||
RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
|
||||
@ -756,6 +758,8 @@ int pqihandler::ExtractRates(std::map<std::string, RsBwRates> &ratemap, RsBw
|
||||
|
||||
total.mRateIn += peerRates.mRateIn;
|
||||
total.mRateOut += peerRates.mRateOut;
|
||||
total.mQueueIn += peerRates.mQueueIn;
|
||||
total.mQueueOut += peerRates.mQueueOut;
|
||||
|
||||
ratemap[it->first] = peerRates;
|
||||
|
||||
|
@ -452,6 +452,23 @@ pqiconnect *pqiperson::getKid(uint32_t type)
|
||||
}
|
||||
}
|
||||
|
||||
void pqiperson::getRates(RsBwRates &rates)
|
||||
{
|
||||
// get the rate from the active one.
|
||||
if ((!active) || (activepqi == NULL))
|
||||
return;
|
||||
activepqi -> getRates(rates);
|
||||
}
|
||||
|
||||
int pqiperson::getQueueSize(bool in)
|
||||
{
|
||||
// get the rate from the active one.
|
||||
if ((!active) || (activepqi == NULL))
|
||||
return 0;
|
||||
return activepqi -> getQueueSize(in);
|
||||
}
|
||||
|
||||
|
||||
float pqiperson::getRate(bool in)
|
||||
{
|
||||
// get the rate from the active one.
|
||||
|
@ -136,6 +136,8 @@ virtual int tick();
|
||||
int notifyEvent(NetInterface *ni, int event);
|
||||
|
||||
// PQInterface for rate control overloaded....
|
||||
virtual int getQueueSize(bool in);
|
||||
virtual void getRates(RsBwRates &rates);
|
||||
virtual float getRate(bool in);
|
||||
virtual void setMaxRate(bool in, float val);
|
||||
virtual void setRateCap(float val_in, float val_out);
|
||||
|
@ -924,3 +924,18 @@ void pqistreamer::inReadBytes(int inb)
|
||||
return;
|
||||
}
|
||||
|
||||
int pqistreamer::getQueueSize(bool in)
|
||||
{
|
||||
if (in)
|
||||
return incoming.size();
|
||||
return out_pkt.size();
|
||||
}
|
||||
|
||||
void pqistreamer::getRates(RsBwRates &rates)
|
||||
{
|
||||
RateInterface::getRates(rates);
|
||||
rates.mQueueIn = incoming.size();
|
||||
rates.mQueueOut = out_pkt.size();
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,7 +59,8 @@ class pqistreamer: public PQInterface
|
||||
virtual int status();
|
||||
|
||||
time_t getLastIncomingTS(); // Time of last data packet, for checking a connection is alive.
|
||||
|
||||
virtual void getRates(RsBwRates &rates);
|
||||
virtual int getQueueSize(bool in); // extracting data.
|
||||
private:
|
||||
/* Implementation */
|
||||
|
||||
|
@ -146,6 +146,9 @@ class RsConfigDataRates
|
||||
mAllowedOut = 0;
|
||||
|
||||
mAllowedTs = 0;
|
||||
|
||||
mQueueIn = 0;
|
||||
mQueueOut = 0;
|
||||
}
|
||||
|
||||
/* all in kB/s */
|
||||
@ -160,6 +163,9 @@ class RsConfigDataRates
|
||||
float mAllowedOut;
|
||||
|
||||
time_t mAllowedTs;
|
||||
|
||||
int mQueueIn;
|
||||
int mQueueOut;
|
||||
};
|
||||
|
||||
|
||||
|
@ -225,6 +225,9 @@ int p3BandwidthControl::getTotalBandwidthRates(RsConfigDataRates &rates)
|
||||
rates.mAllowedOut = 0;
|
||||
rates.mAllowedTs = 0;
|
||||
|
||||
rates.mQueueIn = mTotalRates.mQueueIn;
|
||||
rates.mQueueOut = mTotalRates.mQueueOut;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -248,6 +251,9 @@ int p3BandwidthControl::getAllBandwidthRates(std::map<std::string, RsConfigDataR
|
||||
rates.mAllowedOut = bit->second.mAllowedOut / 1000.0;
|
||||
rates.mAllowedTs = bit->second.mLastRecvd;
|
||||
|
||||
rates.mQueueIn = bit->second.mRates.mQueueIn;
|
||||
rates.mQueueOut = bit->second.mRates.mQueueOut;
|
||||
|
||||
ratemap[bit->first] = rates;
|
||||
}
|
||||
return true ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user