mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-22 00:59:08 +01:00
spinlock added
This commit is contained in:
parent
b1f8f9830b
commit
f17df1f16d
1 changed files with 6 additions and 2 deletions
|
@ -376,13 +376,16 @@ namespace data
|
||||||
|
|
||||||
void IdentityEx::UpdateVerifier (i2p::crypto::Verifier * verifier) const
|
void IdentityEx::UpdateVerifier (i2p::crypto::Verifier * verifier) const
|
||||||
{
|
{
|
||||||
if (!m_Verifier || !verifier)
|
if (!m_Verifier)
|
||||||
{
|
{
|
||||||
auto created = m_IsVerifierCreated.exchange (true);
|
auto created = m_IsVerifierCreated.exchange (true);
|
||||||
if (!created)
|
if (!created)
|
||||||
m_Verifier.reset (verifier);
|
m_Verifier.reset (verifier);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
delete verifier;
|
delete verifier;
|
||||||
|
while (!m_Verifier) ; // spin lock
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
delete verifier;
|
delete verifier;
|
||||||
|
@ -391,7 +394,8 @@ namespace data
|
||||||
void IdentityEx::DropVerifier () const
|
void IdentityEx::DropVerifier () const
|
||||||
{
|
{
|
||||||
// TODO: potential race condition with Verify
|
// TODO: potential race condition with Verify
|
||||||
m_Verifier = nullptr;
|
m_IsVerifierCreated = false;
|
||||||
|
m_Verifier = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivateKeys& PrivateKeys::operator=(const Keys& keys)
|
PrivateKeys& PrivateKeys::operator=(const Keys& keys)
|
||||||
|
|
Loading…
Add table
Reference in a new issue