mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 07:47:03 -05:00
Merge branch 'master' of github.com:RetroShare/RetroShare
This commit is contained in:
commit
c07f93992c
@ -41,11 +41,12 @@ class RsBroadcastDiscovery;
|
|||||||
* TODO: this should become std::weak_ptr once we have a reasonable services
|
* TODO: this should become std::weak_ptr once we have a reasonable services
|
||||||
* management.
|
* management.
|
||||||
*/
|
*/
|
||||||
extern std::shared_ptr<RsBroadcastDiscovery> rsBroadcastDiscovery;
|
extern RsBroadcastDiscovery* rsBroadcastDiscovery;
|
||||||
|
|
||||||
|
|
||||||
struct RsBroadcastDiscoveryResult : RsSerializable
|
struct RsBroadcastDiscoveryResult : RsSerializable
|
||||||
{
|
{
|
||||||
|
RsPgpFingerprint mPgpFingerprint;
|
||||||
RsPeerId mSslId;
|
RsPeerId mSslId;
|
||||||
std::string mProfileName;
|
std::string mProfileName;
|
||||||
RsUrl mLocator;
|
RsUrl mLocator;
|
||||||
@ -54,6 +55,7 @@ struct RsBroadcastDiscoveryResult : RsSerializable
|
|||||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||||
RsGenericSerializer::SerializeContext& ctx) override
|
RsGenericSerializer::SerializeContext& ctx) override
|
||||||
{
|
{
|
||||||
|
RS_SERIAL_PROCESS(mPgpFingerprint);
|
||||||
RS_SERIAL_PROCESS(mSslId);
|
RS_SERIAL_PROCESS(mSslId);
|
||||||
RS_SERIAL_PROCESS(mProfileName);
|
RS_SERIAL_PROCESS(mProfileName);
|
||||||
RS_SERIAL_PROCESS(mLocator);
|
RS_SERIAL_PROCESS(mLocator);
|
||||||
|
@ -1429,9 +1429,9 @@ int RsServer::StartupRetroShare()
|
|||||||
mStatusSrv = new p3StatusService(serviceCtrl);
|
mStatusSrv = new p3StatusService(serviceCtrl);
|
||||||
|
|
||||||
#ifdef RS_BROADCAST_DISCOVERY
|
#ifdef RS_BROADCAST_DISCOVERY
|
||||||
rsBroadcastDiscovery.reset(new BroadcastDiscoveryService(*rsPeers));
|
BroadcastDiscoveryService* broadcastDiscoveryService =
|
||||||
BroadcastDiscoveryService& tBroadcastDiscoveryService =
|
new BroadcastDiscoveryService(*rsPeers);
|
||||||
static_cast<BroadcastDiscoveryService&>(*rsBroadcastDiscovery);
|
rsBroadcastDiscovery = broadcastDiscoveryService;
|
||||||
#endif // def RS_BROADCAST_DISCOVERY
|
#endif // def RS_BROADCAST_DISCOVERY
|
||||||
|
|
||||||
#ifdef ENABLE_GROUTER
|
#ifdef ENABLE_GROUTER
|
||||||
@ -1828,7 +1828,7 @@ int RsServer::StartupRetroShare()
|
|||||||
#endif // RS_ENABLE_GXS
|
#endif // RS_ENABLE_GXS
|
||||||
|
|
||||||
#ifdef RS_BROADCAST_DISCOVERY
|
#ifdef RS_BROADCAST_DISCOVERY
|
||||||
startServiceThread(&tBroadcastDiscoveryService, "Broadcast Discovery");
|
startServiceThread(broadcastDiscoveryService, "Broadcast Discovery");
|
||||||
#endif // def RS_BROADCAST_DISCOVERY
|
#endif // def RS_BROADCAST_DISCOVERY
|
||||||
|
|
||||||
ftserver->StartupThreads();
|
ftserver->StartupThreads();
|
||||||
|
@ -31,15 +31,13 @@
|
|||||||
#include "serialiser/rsserializer.h"
|
#include "serialiser/rsserializer.h"
|
||||||
#include "retroshare/rsevents.h"
|
#include "retroshare/rsevents.h"
|
||||||
|
|
||||||
/*extern*/ std::shared_ptr<RsBroadcastDiscovery> rsBroadcastDiscovery(nullptr);
|
/*extern*/ RsBroadcastDiscovery* rsBroadcastDiscovery = nullptr;
|
||||||
RsBroadcastDiscovery::~RsBroadcastDiscovery() { /* Beware of Rs prefix! */ }
|
|
||||||
RsBroadcastDiscoveryResult::~RsBroadcastDiscoveryResult() {}
|
|
||||||
RsBroadcastDiscoveryPeerFoundEvent::~RsBroadcastDiscoveryPeerFoundEvent() {}
|
|
||||||
|
|
||||||
struct BroadcastDiscoveryPack : RsSerializable
|
struct BroadcastDiscoveryPack : RsSerializable
|
||||||
{
|
{
|
||||||
BroadcastDiscoveryPack() : mLocalPort(0) {}
|
BroadcastDiscoveryPack() : mLocalPort(0) {}
|
||||||
|
|
||||||
|
RsPgpFingerprint mPgpFingerprint;
|
||||||
RsPeerId mSslId;
|
RsPeerId mSslId;
|
||||||
uint16_t mLocalPort;
|
uint16_t mLocalPort;
|
||||||
std::string mProfileName;
|
std::string mProfileName;
|
||||||
@ -47,6 +45,7 @@ struct BroadcastDiscoveryPack : RsSerializable
|
|||||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||||
RsGenericSerializer::SerializeContext& ctx ) override
|
RsGenericSerializer::SerializeContext& ctx ) override
|
||||||
{
|
{
|
||||||
|
RS_SERIAL_PROCESS(mPgpFingerprint);
|
||||||
RS_SERIAL_PROCESS(mSslId);
|
RS_SERIAL_PROCESS(mSslId);
|
||||||
RS_SERIAL_PROCESS(mLocalPort);
|
RS_SERIAL_PROCESS(mLocalPort);
|
||||||
RS_SERIAL_PROCESS(mProfileName);
|
RS_SERIAL_PROCESS(mProfileName);
|
||||||
@ -55,6 +54,7 @@ struct BroadcastDiscoveryPack : RsSerializable
|
|||||||
static BroadcastDiscoveryPack fromPeerDetails(const RsPeerDetails& pd)
|
static BroadcastDiscoveryPack fromPeerDetails(const RsPeerDetails& pd)
|
||||||
{
|
{
|
||||||
BroadcastDiscoveryPack bdp;
|
BroadcastDiscoveryPack bdp;
|
||||||
|
bdp.mPgpFingerprint = pd.fpr;
|
||||||
bdp.mSslId = pd.id;
|
bdp.mSslId = pd.id;
|
||||||
bdp.mLocalPort = pd.localPort;
|
bdp.mLocalPort = pd.localPort;
|
||||||
bdp.mProfileName = pd.name;
|
bdp.mProfileName = pd.name;
|
||||||
@ -86,7 +86,6 @@ struct BroadcastDiscoveryPack : RsSerializable
|
|||||||
~BroadcastDiscoveryPack() override;
|
~BroadcastDiscoveryPack() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
BroadcastDiscoveryPack::~BroadcastDiscoveryPack() {};
|
|
||||||
|
|
||||||
BroadcastDiscoveryService::BroadcastDiscoveryService(
|
BroadcastDiscoveryService::BroadcastDiscoveryService(
|
||||||
RsPeers& pRsPeers ) :
|
RsPeers& pRsPeers ) :
|
||||||
@ -202,3 +201,8 @@ RsBroadcastDiscoveryResult BroadcastDiscoveryService::createResult(
|
|||||||
|
|
||||||
return rbdr;
|
return rbdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsBroadcastDiscovery::~RsBroadcastDiscovery() = default;
|
||||||
|
RsBroadcastDiscoveryResult::~RsBroadcastDiscoveryResult() = default;
|
||||||
|
RsBroadcastDiscoveryPeerFoundEvent::~RsBroadcastDiscoveryPeerFoundEvent() = default;
|
||||||
|
BroadcastDiscoveryPack::~BroadcastDiscoveryPack() = default;
|
||||||
|
@ -2061,29 +2061,41 @@ void p3GxsCircles::handle_event(uint32_t event_type, const std::string &elabel)
|
|||||||
// | | Grp Subscribed: NO | Grp Subscribed: NO |
|
// | | Grp Subscribed: NO | Grp Subscribed: NO |
|
||||||
// +-------------+------------------------------+-----------------------------+
|
// +-------------+------------------------------+-----------------------------+
|
||||||
|
|
||||||
bool p3GxsCircles::pushCircleMembershipRequest(const RsGxsId& own_gxsid,const RsGxsCircleId& circle_id,uint32_t request_type)
|
bool p3GxsCircles::pushCircleMembershipRequest(
|
||||||
|
const RsGxsId& own_gxsid, const RsGxsCircleId& circle_id,
|
||||||
|
uint32_t request_type )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CIRCLES
|
Dbg3() << __PRETTY_FUNCTION__ << "own_gxsid = " << own_gxsid
|
||||||
std::cerr << "Circle membership request: own_gxsid = " << own_gxsid << ", circle=" << circle_id << ", req type=" << request_type << std::endl;
|
<< ", circle=" << circle_id << ", req type=" << request_type
|
||||||
#endif
|
<< std::endl;
|
||||||
|
|
||||||
// check for some consistency
|
|
||||||
|
|
||||||
if(request_type != RsGxsCircleSubscriptionRequestItem::SUBSCRIPTION_REQUEST_SUBSCRIBE && request_type != RsGxsCircleSubscriptionRequestItem::SUBSCRIPTION_REQUEST_UNSUBSCRIBE)
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
std::list<RsGxsId> own_ids ;
|
|
||||||
if(!rsIdentity->getOwnIds(own_ids))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
bool found = false ;
|
|
||||||
for(std::list<RsGxsId>::const_iterator it(own_ids.begin());it!=own_ids.end() && !found;++it)
|
|
||||||
found = ( (*it) == own_gxsid) ;
|
|
||||||
|
|
||||||
if(!found)
|
if( request_type !=
|
||||||
return false ;
|
RsGxsCircleSubscriptionRequestItem::SUBSCRIPTION_REQUEST_SUBSCRIBE &&
|
||||||
|
request_type !=
|
||||||
// Create a subscribe item
|
RsGxsCircleSubscriptionRequestItem::SUBSCRIPTION_REQUEST_UNSUBSCRIBE )
|
||||||
|
{
|
||||||
|
RsErr() << __PRETTY_FUNCTION__ << " Unknown request type: "
|
||||||
|
<< request_type << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!rsIdentity->isOwnId(own_gxsid))
|
||||||
|
{
|
||||||
|
RsErr() << __PRETTY_FUNCTION__ << " Cannot generate membership request "
|
||||||
|
<< "from not-own id: " << own_gxsid << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!getCirclesInfo(
|
||||||
|
std::list<RsGxsGroupId>{static_cast<RsGxsGroupId>(circle_id)},
|
||||||
|
RS_DEFAULT_STORAGE_PARAM(std::vector<RsGxsCircleGroup>) ))
|
||||||
|
{
|
||||||
|
RsErr() << __PRETTY_FUNCTION__ << " Cannot generate membership request "
|
||||||
|
<< "from unknown circle: " << circle_id << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a subscribe item
|
||||||
|
|
||||||
RsGxsCircleSubscriptionRequestItem *s = new RsGxsCircleSubscriptionRequestItem ;
|
RsGxsCircleSubscriptionRequestItem *s = new RsGxsCircleSubscriptionRequestItem ;
|
||||||
|
|
||||||
|
@ -26,12 +26,11 @@
|
|||||||
#include "retroshare/rsgxscircles.h" // External Interfaces.
|
#include "retroshare/rsgxscircles.h" // External Interfaces.
|
||||||
#include "gxs/rsgenexchange.h" // GXS service.
|
#include "gxs/rsgenexchange.h" // GXS service.
|
||||||
#include "gxs/rsgixs.h" // Internal Interfaces.
|
#include "gxs/rsgixs.h" // Internal Interfaces.
|
||||||
|
|
||||||
#include "services/p3idservice.h" // For constructing Caches
|
#include "services/p3idservice.h" // For constructing Caches
|
||||||
|
|
||||||
#include "gxs/gxstokenqueue.h"
|
#include "gxs/gxstokenqueue.h"
|
||||||
#include "util/rstickevent.h"
|
#include "util/rstickevent.h"
|
||||||
#include "util/rsmemcache.h"
|
#include "util/rsmemcache.h"
|
||||||
|
#include "util/rsdebug.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -321,4 +320,6 @@ virtual RsServiceInfo getServiceInfo();
|
|||||||
uint32_t mDummyIdToken;
|
uint32_t mDummyIdToken;
|
||||||
std::list<RsGxsId> mDummyPgpLinkedIds;
|
std::list<RsGxsId> mDummyPgpLinkedIds;
|
||||||
std::list<RsGxsId> mDummyOwnIds;
|
std::list<RsGxsId> mDummyOwnIds;
|
||||||
|
|
||||||
|
RS_SET_CONTEXT_DEBUG_LEVEL(2)
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user