mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 07:47:03 -05:00
removed deadlock by replacing lock() by trylock(). As a result sometimes, authGPG::getDetails() may return false. As soon as it is used by the GUI only, it shoul dbe ok.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1823 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6a48284c31
commit
e77064eaf1
@ -1331,20 +1331,15 @@ void GPGAuthMgr::addTrustingPeer(std::string)
|
||||
}
|
||||
|
||||
/**** These Two are common */
|
||||
std::string GPGAuthMgr::getName(std::string id)
|
||||
std::string GPGAuthMgr::getPGPName(std::string id)
|
||||
{
|
||||
std::string name = AuthSSL::getName(id);
|
||||
if (name != "")
|
||||
{
|
||||
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
||||
|
||||
certmap::iterator it;
|
||||
if (mKeyList.end() != (it = mKeyList.find(id)))
|
||||
{
|
||||
return it->second.user.name;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
bool GPGAuthMgr::getDetails(std::string id, pqiAuthDetails &details)
|
||||
@ -1360,8 +1355,9 @@ bool GPGAuthMgr::getDetails(std::string id, pqiAuthDetails &details)
|
||||
|
||||
if (AuthSSL::getDetails(id, details))
|
||||
{
|
||||
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
||||
|
||||
//RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
||||
if(pgpMtx.trylock())
|
||||
{
|
||||
certmap::iterator it;
|
||||
if (mKeyList.end() != (it = mKeyList.find(details.issuer)))
|
||||
{
|
||||
@ -1371,24 +1367,30 @@ bool GPGAuthMgr::getDetails(std::string id, pqiAuthDetails &details)
|
||||
details.email = it->second.user.email;
|
||||
|
||||
//details = it->second.user;
|
||||
}
|
||||
pgpMtx.unlock() ;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
{
|
||||
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
||||
|
||||
//RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
||||
if(pgpMtx.trylock())
|
||||
{
|
||||
/* if we cannot find a ssl cert - might be a pgp cert */
|
||||
certmap::iterator it;
|
||||
if (mKeyList.end() != (it = mKeyList.find(id)))
|
||||
{
|
||||
/* what do we want from the gpg mgr */
|
||||
details = it->second.user;
|
||||
pgpMtx.unlock() ;
|
||||
return true;
|
||||
}
|
||||
pgpMtx.unlock() ;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user