Switched most of the services to use p3ServiceControl instead of p3LinkMgr.

- Added a couple of utility fns to p3ServiceControl too.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7211 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2014-03-29 03:57:44 +00:00
parent efe9503c3a
commit 190988c3cc
33 changed files with 387 additions and 329 deletions

View file

@ -30,13 +30,19 @@
RsServiceControl *rsServiceControl = NULL;
p3ServiceControl::p3ServiceControl(p3LinkMgr *linkMgr, uint32_t configId)
p3ServiceControl::p3ServiceControl(p3LinkMgr *linkMgr)
:RsServiceControl(), /* p3Config(configId), pqiMonitor(), */
mLinkMgr(linkMgr),
mLinkMgr(linkMgr), mOwnPeerId(linkMgr->getOwnId()),
mCtrlMtx("p3ServiceControl"), mMonitorMtx("P3ServiceControl::Monitor")
{
}
const RsPeerId& p3ServiceControl::getOwnId()
{
return mOwnPeerId;
}
/* Interface for Services */
bool p3ServiceControl::registerService(const RsServiceInfo &info, bool defaultOn)
{
@ -820,6 +826,23 @@ void p3ServiceControl::getPeersConnected(const uint32_t serviceId, std::set<RsPe
}
bool p3ServiceControl::isPeerConnected(const uint32_t serviceId, const RsPeerId &peerId)
{
RsStackMutex stack(mCtrlMtx); /***** LOCK STACK MUTEX ****/
std::map<uint32_t, std::set<RsPeerId> >::iterator mit;
mit = mServicePeerMap.find(serviceId);
if (mit != mServicePeerMap.end())
{
std::set<RsPeerId>::iterator sit;
sit = mit->second.find(peerId);
return (sit != mit->second.end());
}
return false;
}
/****************************************************************************/
/****************************************************************************/