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 */
|
/**** These Two are common */
|
||||||
std::string GPGAuthMgr::getName(std::string id)
|
std::string GPGAuthMgr::getPGPName(std::string id)
|
||||||
{
|
{
|
||||||
std::string name = AuthSSL::getName(id);
|
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
||||||
if (name != "")
|
|
||||||
{
|
|
||||||
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
|
||||||
|
|
||||||
certmap::iterator it;
|
certmap::iterator it;
|
||||||
if (mKeyList.end() != (it = mKeyList.find(id)))
|
if (mKeyList.end() != (it = mKeyList.find(id)))
|
||||||
{
|
return it->second.user.name;
|
||||||
return it->second.user.name;
|
|
||||||
}
|
return std::string();
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GPGAuthMgr::getDetails(std::string id, pqiAuthDetails &details)
|
bool GPGAuthMgr::getDetails(std::string id, pqiAuthDetails &details)
|
||||||
@ -1360,35 +1355,42 @@ bool GPGAuthMgr::getDetails(std::string id, pqiAuthDetails &details)
|
|||||||
|
|
||||||
if (AuthSSL::getDetails(id, 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)))
|
|
||||||
{
|
{
|
||||||
/* what do we want from the gpg mgr */
|
certmap::iterator it;
|
||||||
details.location = details.location;
|
if (mKeyList.end() != (it = mKeyList.find(details.issuer)))
|
||||||
details.name = it->second.user.name;
|
{
|
||||||
details.email = it->second.user.email;
|
/* what do we want from the gpg mgr */
|
||||||
|
details.location = details.location;
|
||||||
|
details.name = it->second.user.name;
|
||||||
|
details.email = it->second.user.email;
|
||||||
|
|
||||||
//details = it->second.user;
|
//details = it->second.user;
|
||||||
|
}
|
||||||
|
pgpMtx.unlock() ;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false ;
|
||||||
}
|
}
|
||||||
else
|
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 */
|
/* if we cannot find a ssl cert - might be a pgp cert */
|
||||||
details = it->second.user;
|
certmap::iterator it;
|
||||||
return true;
|
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;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user