mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
added a display of turtle search/tunnel requests over time, to help spotting potential spammers
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4216 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0429baf807
commit
3f21835114
7 changed files with 270 additions and 52 deletions
|
@ -2040,8 +2040,8 @@ static std::string printNumber(uint64_t num,bool hex=false)
|
|||
|
||||
void p3turtle::getInfo( std::vector<std::vector<std::string> >& hashes_info,
|
||||
std::vector<std::vector<std::string> >& tunnels_info,
|
||||
std::vector<std::vector<std::string> >& search_reqs_info,
|
||||
std::vector<std::vector<std::string> >& tunnel_reqs_info) const
|
||||
std::vector<TurtleRequestDisplayInfo >& search_reqs_info,
|
||||
std::vector<TurtleRequestDisplayInfo >& tunnel_reqs_info) const
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
@ -2091,35 +2091,28 @@ void p3turtle::getInfo( std::vector<std::vector<std::string> >& hashes_info,
|
|||
|
||||
for(std::map<TurtleSearchRequestId,TurtleRequestInfo>::const_iterator it(_search_requests_origins.begin());it!=_search_requests_origins.end();++it)
|
||||
{
|
||||
search_reqs_info.push_back(std::vector<std::string>()) ;
|
||||
std::vector<std::string>& search_req(search_reqs_info.back()) ;
|
||||
TurtleRequestDisplayInfo info ;
|
||||
|
||||
search_req.push_back(printNumber(it->first,true)) ;
|
||||
info.request_id = it->first ;
|
||||
info.source_peer_id = it->second.origin ;
|
||||
info.age = now - it->second.time_stamp ;
|
||||
info.depth = it->second.depth ;
|
||||
|
||||
RsPeerDetails sslDetails;
|
||||
if(rsPeers->getPeerDetails(it->second.origin,sslDetails))
|
||||
search_req.push_back(sslDetails.name + " - " + sslDetails.location) ;
|
||||
else
|
||||
search_req.push_back(it->second.origin) ;
|
||||
|
||||
search_req.push_back(printNumber(now - it->second.time_stamp) + " secs ago") ;
|
||||
search_reqs_info.push_back(info) ;
|
||||
}
|
||||
|
||||
tunnel_reqs_info.clear();
|
||||
|
||||
for(std::map<TurtleSearchRequestId,TurtleRequestInfo>::const_iterator it(_tunnel_requests_origins.begin());it!=_tunnel_requests_origins.end();++it)
|
||||
{
|
||||
tunnel_reqs_info.push_back(std::vector<std::string>()) ;
|
||||
std::vector<std::string>& tunnel_req(tunnel_reqs_info.back()) ;
|
||||
TurtleRequestDisplayInfo info ;
|
||||
|
||||
tunnel_req.push_back(printNumber(it->first,true)) ;
|
||||
RsPeerDetails sslDetails;
|
||||
if(rsPeers->getPeerDetails(it->second.origin,sslDetails))
|
||||
tunnel_req.push_back(sslDetails.name + " - " + sslDetails.location) ;
|
||||
else
|
||||
tunnel_req.push_back(it->second.origin) ;
|
||||
info.request_id = it->first ;
|
||||
info.source_peer_id = it->second.origin ;
|
||||
info.age = now - it->second.time_stamp ;
|
||||
info.depth = it->second.depth ;
|
||||
|
||||
tunnel_req.push_back(printNumber(now - it->second.time_stamp) + " secs ago") ;
|
||||
tunnel_reqs_info.push_back(info) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -244,8 +244,8 @@ class p3turtle: public p3Service, /*public pqiMonitor,*/ public RsTurtle,/* publ
|
|||
/// get info about tunnels
|
||||
virtual void getInfo(std::vector<std::vector<std::string> >&,
|
||||
std::vector<std::vector<std::string> >&,
|
||||
std::vector<std::vector<std::string> >&,
|
||||
std::vector<std::vector<std::string> >&) const ;
|
||||
std::vector<TurtleRequestDisplayInfo >&,
|
||||
std::vector<TurtleRequestDisplayInfo >&) const ;
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
/************* from pqiMonitor *******************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue