diff --git a/libretroshare/src/pqi/p3servicecontrol.cc b/libretroshare/src/pqi/p3servicecontrol.cc index 29c2991f6..e6f2ce25d 100644 --- a/libretroshare/src/pqi/p3servicecontrol.cc +++ b/libretroshare/src/pqi/p3servicecontrol.cc @@ -141,6 +141,19 @@ void p3ServiceControl::getServiceChanges(std::set &updateSet) } +bool p3ServiceControl::getOwnServices(RsPeerServiceInfo &info) +{ + std::cerr << "p3ServiceControl::getOwnServices()"; + std::cerr << std::endl; + + RsStackMutex stack(mCtrlMtx); /***** LOCK STACK MUTEX ****/ + + info.mPeerId = ""; + info.mServiceList = mOwnServices; + return true; +} + + bool p3ServiceControl::getServicesAllowed(const RsPeerId &peerId, RsPeerServiceInfo &info) { std::cerr << "p3ServiceControl::getServicesAllowed(" << peerId.toStdString() << ")"; @@ -391,7 +404,7 @@ bool versionOkay(uint16_t version_major, uint16_t version_minor, } -bool servicesCompatible(const RsServiceInfo &info1, const RsServiceInfo &info2) +bool ServiceInfoCompatible(const RsServiceInfo &info1, const RsServiceInfo &info2) { // Id, or Name mismatch. if ((info1.mServiceType != info2.mServiceType) || @@ -521,7 +534,7 @@ bool p3ServiceControl::updateFilterByPeer_locked(const RsPeerId &peerId) std::cerr << std::endl; /* match of service IDs */ /* check if compatible */ - if (servicesCompatible(oit->second, tit->second)) + if (ServiceInfoCompatible(oit->second, tit->second)) { if (peerHasPermissionForService_locked(peerId, oit->first)) { diff --git a/libretroshare/src/pqi/p3servicecontrol.h b/libretroshare/src/pqi/p3servicecontrol.h index 068fa9518..4bed41ac3 100644 --- a/libretroshare/src/pqi/p3servicecontrol.h +++ b/libretroshare/src/pqi/p3servicecontrol.h @@ -73,6 +73,8 @@ public: * External Interface (RsServiceControl). */ +virtual bool getOwnServices(RsPeerServiceInfo &info); + // This is what is passed to peers, can be displayed by GUI too. virtual bool getServicesAllowed(const RsPeerId &peerId, RsPeerServiceInfo &info); diff --git a/libretroshare/src/retroshare/rsservicecontrol.h b/libretroshare/src/retroshare/rsservicecontrol.h index ff3ff17c1..9ee5ad310 100644 --- a/libretroshare/src/retroshare/rsservicecontrol.h +++ b/libretroshare/src/retroshare/rsservicecontrol.h @@ -60,6 +60,10 @@ class RsServiceInfo }; +bool ServiceInfoCompatible(const RsServiceInfo &info1, const RsServiceInfo &info2); + + + /* this is what is transmitted to peers */ class RsPeerServiceInfo { @@ -100,6 +104,8 @@ class RsServiceControl RsServiceControl() { return; } virtual ~RsServiceControl() { return; } +virtual bool getOwnServices(RsPeerServiceInfo &info) = 0; + virtual bool getServicesAllowed(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0; virtual bool getServicesProvided(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0; virtual bool getServicePermissions(uint32_t serviceId, RsServicePermissions &permissions) = 0; diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 79617c960..8ef28343d 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1223,6 +1223,7 @@ int RsServer::StartupRetroShare() /**************************** BITDHT ***********************************/ p3ServiceControl *serviceCtrl = new p3ServiceControl(0); + rsServiceControl = serviceCtrl; SecurityPolicy *none = secpolicy_create(); pqih = new pqisslpersongrp(serviceCtrl, none, flags, mPeerMgr);