Merge pull request #861 from RetroShare/v0.6-GxsTransport

V0.6 gxs transport
This commit is contained in:
csoler 2017-05-30 22:22:06 +02:00 committed by GitHub
commit 1ebcc6006b
58 changed files with 4372 additions and 1167 deletions

View file

@ -1023,7 +1023,8 @@ void p3GxsTunnelService::handleRecvDHPublicKey(RsGxsTunnelDHPublicKeyItem *item)
// Note: for some obscure reason, the typedef does not work here. Looks like a compiler error. So I use the primary type.
GXSTunnelId p3GxsTunnelService::makeGxsTunnelId(const RsGxsId &own_id, const RsGxsId &distant_id) const // creates a unique ID from two GXS ids.
/*static*/ GXSTunnelId p3GxsTunnelService::makeGxsTunnelId(
const RsGxsId &own_id, const RsGxsId &distant_id )
{
unsigned char mem[RsGxsId::SIZE_IN_BYTES * 2] ;
@ -1244,18 +1245,20 @@ bool p3GxsTunnelService::locked_sendEncryptedTunnelData(RsGxsTunnelItem *item)
std::map<RsGxsTunnelId,GxsTunnelPeerInfo>::iterator it = _gxs_tunnel_contacts.find(tunnel_id) ;
if(it == _gxs_tunnel_contacts.end())
{
if(it == _gxs_tunnel_contacts.end())
{
#ifdef DEBUG_GXS_TUNNEL
std::cerr << " Cannot find contact key info for tunnel id " << tunnel_id << ". Cannot send message!" << std::endl;
std::cerr << " Cannot find contact key info for tunnel id "
<< tunnel_id << ". Cannot send message!" << std::endl;
#endif
return false;
}
if(it->second.status != RS_GXS_TUNNEL_STATUS_CAN_TALK)
{
std::cerr << "(EE) Cannot talk to tunnel id " << tunnel_id << ". Tunnel status is: " << it->second.status << std::endl;
return false;
}
return false;
}
if(it->second.status != RS_GXS_TUNNEL_STATUS_CAN_TALK)
{
std::cerr << "(EE) Cannot talk to tunnel id " << tunnel_id
<< ". Tunnel status is: " << it->second.status << std::endl;
return false;
}
it->second.total_sent += rssize ; // counts the size of clear data that is sent

View file

@ -232,7 +232,6 @@ private:
bool locked_initDHSessionKey(DH *&dh);
TurtleVirtualPeerId virtualPeerIdFromHash(const TurtleFileHash& hash) ; // ... and to a hash for p3turtle
RsGxsTunnelId makeGxsTunnelId(const RsGxsId &own_id, const RsGxsId &distant_id) const; // creates a unique ID from two GXS ids.
// item handling
@ -256,5 +255,10 @@ private:
std::map<uint32_t,RsGxsTunnelClientService*> mRegisteredServices ;
void debug_dump();
public:
/// creates a unique tunnel ID from two GXS ids.
static RsGxsTunnelId makeGxsTunnelId( const RsGxsId &own_id,
const RsGxsId &distant_id );
};