mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-12 00:00:44 -04:00
added missing mutex, and warnings if permission flags methods are not called with correct ids
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6287 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c2512318a3
commit
8399ce82ee
3 changed files with 29 additions and 8 deletions
|
@ -1813,26 +1813,47 @@ bool p3PeerMgrIMPL::assignPeersToGroup(const std::string &groupId, const std::li
|
|||
|
||||
ServicePermissionFlags p3PeerMgrIMPL::servicePermissionFlags_sslid(const std::string& ssl_id)
|
||||
{
|
||||
std::string gpg_id ;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
if(ssl_id.length() != 32)
|
||||
{
|
||||
std::cerr << "(EE) p3PeerMgrIMPL::servicePermissionFlags_sslid() called with inconsistent id " << ssl_id << std::endl;
|
||||
return RS_SERVICE_PERM_ALL ;
|
||||
}
|
||||
std::map<std::string, peerState>::const_iterator it = mFriendList.find(ssl_id);
|
||||
|
||||
if(it == mFriendList.end())
|
||||
return RS_SERVICE_PERM_ALL ;
|
||||
else
|
||||
return servicePermissionFlags(it->second.gpg_id) ;
|
||||
if(it == mFriendList.end())
|
||||
return RS_SERVICE_PERM_ALL ;
|
||||
|
||||
gpg_id = it->second.gpg_id ;
|
||||
}
|
||||
|
||||
return servicePermissionFlags(gpg_id) ;
|
||||
}
|
||||
|
||||
|
||||
ServicePermissionFlags p3PeerMgrIMPL::servicePermissionFlags(const std::string& pgp_id)
|
||||
{
|
||||
//
|
||||
//
|
||||
if(pgp_id.length() != 16)
|
||||
{
|
||||
std::cerr << "(EE) p3PeerMgrIMPL::servicePermissionFlags() called with inconsistent id " << pgp_id << std::endl;
|
||||
return RS_SERVICE_PERM_ALL ;
|
||||
}
|
||||
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string,ServicePermissionFlags>::const_iterator it = mFriendsPermissionFlags.find( pgp_id ) ;
|
||||
|
||||
if(it == mFriendsPermissionFlags.end())
|
||||
return RS_SERVICE_PERM_ALL ;
|
||||
else
|
||||
return it->second ;
|
||||
}
|
||||
}
|
||||
void p3PeerMgrIMPL::setServicePermissionFlags(const std::string& pgp_id, const ServicePermissionFlags& flags)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue