mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 03:19:23 +00:00
Fixed cppcheck issues
This commit is contained in:
parent
a61966ed61
commit
dffc8bcea0
7 changed files with 14 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
|||
unmatchedSuppression
|
||||
missingIncludeSystem
|
||||
unusedFunction
|
||||
useStlAlgorithm
|
||||
|
|
|
@ -145,7 +145,7 @@ struct BlockCache::Impl : public nocopy_nomove
|
|||
|
||||
#else
|
||||
// Not implemented on other platforms
|
||||
void flush() {}
|
||||
void flush() { m_data = nullptr; }
|
||||
#endif
|
||||
|
||||
uint8_t* m_data = nullptr;
|
||||
|
@ -155,6 +155,7 @@ BlockCache::BlockCache()
|
|||
: m_impl(new Impl())
|
||||
, m_flushRunning(0)
|
||||
, m_storeIndex(0)
|
||||
, m_loadingStarted(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -188,6 +189,11 @@ void BlockCache::load_all(SideChain& side_chain, P2PServer& server)
|
|||
return;
|
||||
}
|
||||
|
||||
// Can be only called once
|
||||
if (m_loadingStarted.exchange(1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOGINFO(1, "loading cached blocks");
|
||||
|
||||
PoolBlock block;
|
||||
|
@ -212,7 +218,7 @@ void BlockCache::load_all(SideChain& side_chain, P2PServer& server)
|
|||
|
||||
void BlockCache::flush()
|
||||
{
|
||||
if (m_flushRunning.exchange(1) == 0) {
|
||||
if (m_flushRunning.exchange(1)) {
|
||||
m_impl->flush();
|
||||
m_flushRunning.store(0);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ private:
|
|||
Impl* m_impl;
|
||||
std::atomic<uint32_t> m_flushRunning;
|
||||
std::atomic<uint32_t> m_storeIndex;
|
||||
std::atomic<uint32_t> m_loadingStarted;
|
||||
};
|
||||
|
||||
} // namespace p2pool
|
||||
|
|
|
@ -321,6 +321,7 @@ static Worker worker;
|
|||
|
||||
NOINLINE Writer::Writer(Severity severity) : Stream(m_stackBuf)
|
||||
{
|
||||
m_stackBuf[BUF_SIZE] = '\0';
|
||||
m_buf[0] = static_cast<char>(severity);
|
||||
m_pos = 3;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class p2pool_api;
|
|||
class ZMQReader;
|
||||
struct PoolBlock;
|
||||
|
||||
class p2pool : public MinerCallbackHandler
|
||||
class p2pool : public MinerCallbackHandler, public nocopy_nomove
|
||||
{
|
||||
public:
|
||||
p2pool(int argc, char* argv[]);
|
||||
|
|
|
@ -2024,7 +2024,7 @@ bool SideChain::load_config(const std::string& filename)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SideChain::check_config()
|
||||
bool SideChain::check_config() const
|
||||
{
|
||||
if (m_poolName.empty()) {
|
||||
LOGERR(1, "name can't be empty");
|
||||
|
|
|
@ -99,7 +99,7 @@ private:
|
|||
void prune_old_blocks();
|
||||
|
||||
bool load_config(const std::string& filename);
|
||||
bool check_config();
|
||||
bool check_config() const;
|
||||
|
||||
mutable uv_rwlock_t m_sidechainLock;
|
||||
std::atomic<PoolBlock*> m_chainTip;
|
||||
|
|
Loading…
Reference in a new issue