locking: fix a few small issues uncovered by -Wthread-safety
- rpcwallet: No need to lock twice here - openssl: Clang doesn't understand selective lock/unlock here. Ignore it. - CNode: Fix a legitimate (though very unlikely) locking bug.
This commit is contained in:
parent
cd27bba060
commit
2b890dd424
@ -2032,8 +2032,10 @@ void CNode::EndMessage() UNLOCK_FUNCTION(cs_vSend)
|
|||||||
Fuzz(GetArg("-fuzzmessagestest", 10));
|
Fuzz(GetArg("-fuzzmessagestest", 10));
|
||||||
|
|
||||||
if (ssSend.size() == 0)
|
if (ssSend.size() == 0)
|
||||||
|
{
|
||||||
|
LEAVE_CRITICAL_SECTION(cs_vSend);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// Set the size
|
// Set the size
|
||||||
unsigned int nSize = ssSend.size() - CMessageHeader::HEADER_SIZE;
|
unsigned int nSize = ssSend.size() - CMessageHeader::HEADER_SIZE;
|
||||||
WriteLE32((uint8_t*)&ssSend[CMessageHeader::MESSAGE_SIZE_OFFSET], nSize);
|
WriteLE32((uint8_t*)&ssSend[CMessageHeader::MESSAGE_SIZE_OFFSET], nSize);
|
||||||
|
@ -113,7 +113,7 @@ CTranslationInterface translationInterface;
|
|||||||
|
|
||||||
/** Init OpenSSL library multithreading support */
|
/** Init OpenSSL library multithreading support */
|
||||||
static CCriticalSection** ppmutexOpenSSL;
|
static CCriticalSection** ppmutexOpenSSL;
|
||||||
void locking_callback(int mode, int i, const char* file, int line)
|
void locking_callback(int mode, int i, const char* file, int line) NO_THREAD_SAFETY_ANALYSIS
|
||||||
{
|
{
|
||||||
if (mode & CRYPTO_LOCK) {
|
if (mode & CRYPTO_LOCK) {
|
||||||
ENTER_CRITICAL_SECTION(*ppmutexOpenSSL[i]);
|
ENTER_CRITICAL_SECTION(*ppmutexOpenSSL[i]);
|
||||||
|
@ -476,7 +476,6 @@ UniValue listaddressgroupings(const UniValue& params, bool fHelp)
|
|||||||
addressInfo.push_back(CBitcoinAddress(address).ToString());
|
addressInfo.push_back(CBitcoinAddress(address).ToString());
|
||||||
addressInfo.push_back(ValueFromAmount(balances[address]));
|
addressInfo.push_back(ValueFromAmount(balances[address]));
|
||||||
{
|
{
|
||||||
LOCK(pwalletMain->cs_wallet);
|
|
||||||
if (pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get()) != pwalletMain->mapAddressBook.end())
|
if (pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get()) != pwalletMain->mapAddressBook.end())
|
||||||
addressInfo.push_back(pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get())->second.name);
|
addressInfo.push_back(pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get())->second.name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user