Merge pull request #237 from G10h4ck/master

p3ServiceControl: Optimize checkFilter(...), solve memory leak removi…
This commit is contained in:
Cyril Soler 2016-01-03 14:29:33 -05:00
commit 3d5042b8f4
2 changed files with 460 additions and 703 deletions

File diff suppressed because it is too large Load Diff

View File

@ -46,8 +46,7 @@ class ServiceNotifications
class ServicePeerFilter
{
public:
ServicePeerFilter()
:mDenyAll(true), mAllowAll(false) {}
ServicePeerFilter() : mDenyAll(true), mAllowAll(false) {}
bool mDenyAll;
bool mAllowAll;
@ -61,9 +60,6 @@ class ServiceControlSerialiser ;
class p3ServiceControl: public RsServiceControl, public pqiMonitor, public p3Config
{
public:
/**
*/
p3ServiceControl(p3LinkMgr *linkMgr);
/**
@ -77,13 +73,11 @@ public:
* from ServiceControl.
* @see rsserver
*/
virtual const RsPeerId& getOwnId();
/**
* External Interface (RsServiceControl).
*/
virtual bool getOwnServices(RsPeerServiceInfo &info);
// This is what is passed to peers, can be displayed by GUI too.
@ -103,22 +97,16 @@ virtual bool isPeerConnected(const uint32_t serviceId, const RsPeerId &peerId);
/**
* Registration for all Services.
*/
virtual bool registerService(const RsServiceInfo &info, bool defaultOn);
virtual bool deregisterService(uint32_t serviceId);
virtual bool registerServiceMonitor(pqiServiceMonitor *monitor, uint32_t serviceId);
virtual bool deregisterServiceMonitor(pqiServiceMonitor *monitor);
/**
*
*/
// Filter for services.
virtual bool checkFilter(uint32_t serviceId, const RsPeerId &peerId);
/**
/*
* Interface for ServiceInfo service.
*/
@ -138,7 +126,6 @@ virtual bool loadList(std::list<RsItem *>& load);
virtual RsSerialiser *setupSerialiser() ;
private:
void notifyServices();
void notifyAboutFriends();
@ -157,7 +144,8 @@ bool updateFilterByPeer_locked(const RsPeerId &peerId);
void recordFilterChanges_locked(const RsPeerId &peerId,
ServicePeerFilter &originalFilter, ServicePeerFilter &updatedFilter);
ServicePeerFilter &originalFilter,
ServicePeerFilter &updatedFilter);
// Called from recordFilterChanges.
void filterChangeAdded_locked(const RsPeerId &peerId, uint32_t serviceId);
@ -190,11 +178,8 @@ bool peerHasPermissionForService_locked(const RsPeerId &peerId, uint32_t service
RsMutex mMonitorMtx; /* below is protected */
std::multimap<uint32_t, pqiServiceMonitor *> mMonitors;
ServiceControlSerialiser *mSerialiser ;
// Below here is saved in Configuration.
std::map<uint32_t, RsServicePermissions> mServicePermissionMap;
};