mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-24 07:00:57 -04:00
added limiter in number of responses forwarded back by turtle search, which should avoid bursts of bandwidth for popular requests
This commit is contained in:
parent
558bb9f760
commit
6fe14136ae
7 changed files with 133 additions and 82 deletions
|
@ -71,17 +71,14 @@ void TurtleRouterDialog::processSettings(bool bLoad)
|
|||
|
||||
}
|
||||
|
||||
bool sr_Compare( TurtleRequestDisplayInfo m1, TurtleRequestDisplayInfo m2)
|
||||
{
|
||||
return m1.age < m2.age;
|
||||
}
|
||||
bool sr_Compare( TurtleSearchRequestDisplayInfo m1, TurtleSearchRequestDisplayInfo m2) { return m1.age < m2.age; }
|
||||
|
||||
void TurtleRouterDialog::updateDisplay()
|
||||
{
|
||||
std::vector<std::vector<std::string> > hashes_info ;
|
||||
std::vector<std::vector<std::string> > tunnels_info ;
|
||||
std::vector<TurtleRequestDisplayInfo > search_reqs_info ;
|
||||
std::vector<TurtleRequestDisplayInfo > tunnel_reqs_info ;
|
||||
std::vector<TurtleSearchRequestDisplayInfo > search_reqs_info ;
|
||||
std::vector<TurtleTunnelRequestDisplayInfo > tunnel_reqs_info ;
|
||||
|
||||
rsTurtle->getInfo(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ;
|
||||
|
||||
|
@ -111,8 +108,8 @@ QString TurtleRouterDialog::getPeerName(const RsPeerId& peer_id)
|
|||
|
||||
void TurtleRouterDialog::updateTunnelRequests( const std::vector<std::vector<std::string> >& hashes_info,
|
||||
const std::vector<std::vector<std::string> >& tunnels_info,
|
||||
const std::vector<TurtleRequestDisplayInfo >& search_reqs_info,
|
||||
const std::vector<TurtleRequestDisplayInfo >& tunnel_reqs_info)
|
||||
const std::vector<TurtleSearchRequestDisplayInfo >& search_reqs_info,
|
||||
const std::vector<TurtleTunnelRequestDisplayInfo >& tunnel_reqs_info)
|
||||
{
|
||||
// now display this in the QTableWidgets
|
||||
|
||||
|
@ -169,7 +166,7 @@ void TurtleRouterDialog::updateTunnelRequests( const std::vector<std::vector<std
|
|||
|
||||
for(uint i=0;i<search_reqs_info.size();++i)
|
||||
{
|
||||
QString str = tr("Request id: %1\t %3 secs ago\t from %2\t %4").arg(search_reqs_info[i].request_id,0,16).arg(getPeerName(search_reqs_info[i].source_peer_id), -25).arg(search_reqs_info[i].age).arg(QString::fromUtf8(search_reqs_info[i].keywords.c_str(),search_reqs_info[i].keywords.length()));
|
||||
QString str = tr("Request id: %1\t %3 secs ago\t from %2\t %4 (%5 hits)").arg(search_reqs_info[i].request_id,0,16).arg(getPeerName(search_reqs_info[i].source_peer_id), -25).arg(search_reqs_info[i].age).arg(QString::fromUtf8(search_reqs_info[i].keywords.c_str(),search_reqs_info[i].keywords.length())).arg(QString::number(search_reqs_info[i].hits));
|
||||
|
||||
stl.clear() ;
|
||||
stl.push_back(str) ;
|
||||
|
|
|
@ -21,8 +21,8 @@ class TurtleRouterDialog: public RsAutoUpdatePage, public Ui::TurtleRouterDialog
|
|||
private:
|
||||
void updateTunnelRequests( const std::vector<std::vector<std::basic_string<char> > >&,
|
||||
const std::vector<std::vector<std::basic_string<char> > >&,
|
||||
const std::vector<TurtleRequestDisplayInfo >&,
|
||||
const std::vector<TurtleRequestDisplayInfo >&) ;
|
||||
const std::vector<TurtleSearchRequestDisplayInfo >&,
|
||||
const std::vector<TurtleTunnelRequestDisplayInfo >&) ;
|
||||
|
||||
void processSettings(bool bLoad);
|
||||
bool m_bProcessSettings;
|
||||
|
|
|
@ -35,10 +35,10 @@
|
|||
|
||||
//static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
|
||||
|
||||
class TRHistogram
|
||||
template<class TURTLE_REQ_DISPLAY_INFO> class TRHistogram
|
||||
{
|
||||
public:
|
||||
TRHistogram(const std::vector<TurtleRequestDisplayInfo >& info) :_infos(info) {}
|
||||
TRHistogram(const std::vector<TURTLE_REQ_DISPLAY_INFO>& info) :_infos(info) {}
|
||||
|
||||
QColor colorScale(float f)
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ class TRHistogram
|
|||
}
|
||||
|
||||
private:
|
||||
const std::vector<TurtleRequestDisplayInfo>& _infos ;
|
||||
const std::vector<TURTLE_REQ_DISPLAY_INFO>& _infos ;
|
||||
};
|
||||
|
||||
TurtleRouterStatistics::TurtleRouterStatistics(QWidget *parent)
|
||||
|
@ -242,8 +242,8 @@ void TurtleRouterStatistics::updateDisplay()
|
|||
{
|
||||
std::vector<std::vector<std::string> > hashes_info ;
|
||||
std::vector<std::vector<std::string> > tunnels_info ;
|
||||
std::vector<TurtleRequestDisplayInfo > search_reqs_info ;
|
||||
std::vector<TurtleRequestDisplayInfo > tunnel_reqs_info ;
|
||||
std::vector<TurtleSearchRequestDisplayInfo > search_reqs_info ;
|
||||
std::vector<TurtleTunnelRequestDisplayInfo > tunnel_reqs_info ;
|
||||
|
||||
rsTurtle->getInfo(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ;
|
||||
|
||||
|
@ -279,8 +279,8 @@ TurtleRouterStatisticsWidget::TurtleRouterStatisticsWidget(QWidget *parent)
|
|||
|
||||
void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector<std::vector<std::string> >& /*hashes_info*/,
|
||||
const std::vector<std::vector<std::string> >& /*tunnels_info*/,
|
||||
const std::vector<TurtleRequestDisplayInfo >& search_reqs_info,
|
||||
const std::vector<TurtleRequestDisplayInfo >& tunnel_reqs_info)
|
||||
const std::vector<TurtleSearchRequestDisplayInfo >& search_reqs_info,
|
||||
const std::vector<TurtleTunnelRequestDisplayInfo >& tunnel_reqs_info)
|
||||
|
||||
{
|
||||
QPixmap tmppixmap(maxWidth, maxHeight);
|
||||
|
@ -304,13 +304,13 @@ void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector<std:
|
|||
// draw...
|
||||
int ox=5*fact,oy=5*fact ;
|
||||
|
||||
TRHistogram(search_reqs_info).draw(&painter,ox,oy,tr("Search requests repartition") + ":",fontHeight) ;
|
||||
TRHistogram<TurtleSearchRequestDisplayInfo>(search_reqs_info).draw(&painter,ox,oy,tr("Search requests repartition") + ":",fontHeight) ;
|
||||
|
||||
painter.setPen(QColor::fromRgb(70,70,70)) ;
|
||||
painter.drawLine(0,oy,maxWidth,oy) ;
|
||||
oy += celly ;
|
||||
|
||||
TRHistogram(tunnel_reqs_info).draw(&painter,ox,oy,tr("Tunnel requests repartition") + ":",fontHeight) ;
|
||||
TRHistogram<TurtleTunnelRequestDisplayInfo>(tunnel_reqs_info).draw(&painter,ox,oy,tr("Tunnel requests repartition") + ":",fontHeight) ;
|
||||
|
||||
// now give information about turtle traffic.
|
||||
//
|
||||
|
|
|
@ -62,8 +62,8 @@ class TurtleRouterStatisticsWidget: public QWidget
|
|||
|
||||
void updateTunnelStatistics( const std::vector<std::vector<std::basic_string<char> > >&,
|
||||
const std::vector<std::vector<std::basic_string<char> > >&,
|
||||
const std::vector<TurtleRequestDisplayInfo >&,
|
||||
const std::vector<TurtleRequestDisplayInfo >&) ;
|
||||
const std::vector<TurtleSearchRequestDisplayInfo >&,
|
||||
const std::vector<TurtleTunnelRequestDisplayInfo >&) ;
|
||||
|
||||
private:
|
||||
static QString speedString(float f) ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue