diff --git a/libretroshare/src/retroshare/rsbroadcastdiscovery.h b/libretroshare/src/retroshare/rsbroadcastdiscovery.h index 36ffd4ff2..a712c60af 100644 --- a/libretroshare/src/retroshare/rsbroadcastdiscovery.h +++ b/libretroshare/src/retroshare/rsbroadcastdiscovery.h @@ -41,11 +41,12 @@ class RsBroadcastDiscovery; * TODO: this should become std::weak_ptr once we have a reasonable services * management. */ -extern std::shared_ptr rsBroadcastDiscovery; +extern RsBroadcastDiscovery* rsBroadcastDiscovery; struct RsBroadcastDiscoveryResult : RsSerializable { + RsPgpFingerprint mPgpFingerprint; RsPeerId mSslId; std::string mProfileName; RsUrl mLocator; @@ -54,6 +55,7 @@ struct RsBroadcastDiscoveryResult : RsSerializable void serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx) override { + RS_SERIAL_PROCESS(mPgpFingerprint); RS_SERIAL_PROCESS(mSslId); RS_SERIAL_PROCESS(mProfileName); RS_SERIAL_PROCESS(mLocator); diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index e8e2b518f..4e6c0a6e2 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1429,9 +1429,9 @@ int RsServer::StartupRetroShare() mStatusSrv = new p3StatusService(serviceCtrl); #ifdef RS_BROADCAST_DISCOVERY - rsBroadcastDiscovery.reset(new BroadcastDiscoveryService(*rsPeers)); - BroadcastDiscoveryService& tBroadcastDiscoveryService = - static_cast(*rsBroadcastDiscovery); + BroadcastDiscoveryService* broadcastDiscoveryService = + new BroadcastDiscoveryService(*rsPeers); + rsBroadcastDiscovery = broadcastDiscoveryService; #endif // def RS_BROADCAST_DISCOVERY #ifdef ENABLE_GROUTER @@ -1828,7 +1828,7 @@ int RsServer::StartupRetroShare() #endif // RS_ENABLE_GXS #ifdef RS_BROADCAST_DISCOVERY - startServiceThread(&tBroadcastDiscoveryService, "Broadcast Discovery"); + startServiceThread(broadcastDiscoveryService, "Broadcast Discovery"); #endif // def RS_BROADCAST_DISCOVERY ftserver->StartupThreads(); diff --git a/libretroshare/src/services/broadcastdiscoveryservice.cc b/libretroshare/src/services/broadcastdiscoveryservice.cc index bbcaa307d..526610ced 100644 --- a/libretroshare/src/services/broadcastdiscoveryservice.cc +++ b/libretroshare/src/services/broadcastdiscoveryservice.cc @@ -31,15 +31,13 @@ #include "serialiser/rsserializer.h" #include "retroshare/rsevents.h" -/*extern*/ std::shared_ptr rsBroadcastDiscovery(nullptr); -RsBroadcastDiscovery::~RsBroadcastDiscovery() { /* Beware of Rs prefix! */ } -RsBroadcastDiscoveryResult::~RsBroadcastDiscoveryResult() {} -RsBroadcastDiscoveryPeerFoundEvent::~RsBroadcastDiscoveryPeerFoundEvent() {} +/*extern*/ RsBroadcastDiscovery* rsBroadcastDiscovery = nullptr; struct BroadcastDiscoveryPack : RsSerializable { BroadcastDiscoveryPack() : mLocalPort(0) {} + RsPgpFingerprint mPgpFingerprint; RsPeerId mSslId; uint16_t mLocalPort; std::string mProfileName; @@ -47,6 +45,7 @@ struct BroadcastDiscoveryPack : RsSerializable void serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx ) override { + RS_SERIAL_PROCESS(mPgpFingerprint); RS_SERIAL_PROCESS(mSslId); RS_SERIAL_PROCESS(mLocalPort); RS_SERIAL_PROCESS(mProfileName); @@ -55,6 +54,7 @@ struct BroadcastDiscoveryPack : RsSerializable static BroadcastDiscoveryPack fromPeerDetails(const RsPeerDetails& pd) { BroadcastDiscoveryPack bdp; + bdp.mPgpFingerprint = pd.fpr; bdp.mSslId = pd.id; bdp.mLocalPort = pd.localPort; bdp.mProfileName = pd.name; @@ -86,7 +86,6 @@ struct BroadcastDiscoveryPack : RsSerializable ~BroadcastDiscoveryPack() override; }; -BroadcastDiscoveryPack::~BroadcastDiscoveryPack() {}; BroadcastDiscoveryService::BroadcastDiscoveryService( RsPeers& pRsPeers ) : @@ -202,3 +201,8 @@ RsBroadcastDiscoveryResult BroadcastDiscoveryService::createResult( return rbdr; } + +RsBroadcastDiscovery::~RsBroadcastDiscovery() = default; +RsBroadcastDiscoveryResult::~RsBroadcastDiscoveryResult() = default; +RsBroadcastDiscoveryPeerFoundEvent::~RsBroadcastDiscoveryPeerFoundEvent() = default; +BroadcastDiscoveryPack::~BroadcastDiscoveryPack() = default;