Skip to content

router statistics - filter out gxs tunnels from file tunnels #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/gxs/rsgxsnettunnel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,10 @@ void RsGxsNetTunnelService::getStatistics(
bias = mRandomBias ;
}

bool RsGxsNetTunnelService::isGXSHash(RsFileHash hash) const
{
return mHandledHashes.find(hash) != mHandledHashes.end();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A mutex is missing here as you access a std::map. But having a mutex here would likely cause a deadlock randomly since you call this function from p3turtle and p3turtle is always locked after GXS tunnel and not the reverse.

}



Expand Down
2 changes: 2 additions & 0 deletions src/gxs/rsgxsnettunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ class RsGxsNetTunnelService:
std::map<TurtleVirtualPeerId,RsGxsNetTunnelVirtualPeerId>& turtle_vpid_to_net_tunnel_vpid,
Bias20Bytes& bias) const override ;

bool isGXSHash(RsFileHash hash) const;

RS_DEPRECATED
TurtleRequestId turtleSearchRequest(
const std::string& match_string,
Expand Down
1 change: 1 addition & 0 deletions src/retroshare/rsgxsdistsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class RsGxsDistSync
std::map<TurtleVirtualPeerId,RsGxsNetTunnelVirtualPeerId>& turtle_vpid_to_net_tunnel_vpid,
Bias20Bytes& bias
) const =0;
virtual bool isGXSHash(RsFileHash hash) const =0;
};

extern RsGxsDistSync *rsGxsDistSync ;
Expand Down
7 changes: 7 additions & 0 deletions src/turtle/p3turtle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "pqi/authssl.h"
#include "pqi/p3linkmgr.h"
#include "retroshare/rspeers.h"
#include <retroshare/rsgxsdistsync.h>

#include "ft/ftserver.h"
#include "ft/ftdatamultiplex.h"
Expand Down Expand Up @@ -2372,6 +2373,9 @@ void p3turtle::getInfo( std::vector<std::vector<std::string> >& hashes_info,

for(std::map<TurtleFileHash,TurtleHashInfo>::const_iterator it(_incoming_file_hashes.begin());it!=_incoming_file_hashes.end();++it)
{
if(rsGxsDistSync->isGXSHash(it->first))
continue;

hashes_info.push_back(std::vector<std::string>()) ;

std::vector<std::string>& hashes(hashes_info.back()) ;
Expand All @@ -2387,6 +2391,9 @@ void p3turtle::getInfo( std::vector<std::vector<std::string> >& hashes_info,

for(std::map<TurtleTunnelId,TurtleTunnel>::const_iterator it(_local_tunnels.begin());it!=_local_tunnels.end();++it)
{
if(rsGxsDistSync->isGXSHash(it->second.hash))
continue;

tunnels_info.push_back(std::vector<std::string>()) ;
std::vector<std::string>& tunnel(tunnels_info.back()) ;

Expand Down