mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-01-03 17:29:24 +00:00
P2PServer: show an error when there are no ZMQ messages
This commit is contained in:
parent
77a3a5857c
commit
60a8538e0c
4 changed files with 27 additions and 0 deletions
|
@ -679,6 +679,7 @@ void P2PServer::on_timer()
|
|||
update_peer_list();
|
||||
save_peer_list_async();
|
||||
update_peer_connections();
|
||||
check_zmq();
|
||||
}
|
||||
|
||||
void P2PServer::flush_cache()
|
||||
|
@ -779,6 +780,21 @@ void P2PServer::download_missing_blocks()
|
|||
}
|
||||
}
|
||||
|
||||
void P2PServer::check_zmq()
|
||||
{
|
||||
if ((m_timerCounter % 30) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const time_t cur_time = time(nullptr);
|
||||
const time_t last_active = m_pool->zmq_last_active();
|
||||
|
||||
if (cur_time >= last_active + 300) {
|
||||
const uint64_t dt = static_cast<uint64_t>(cur_time - last_active);
|
||||
LOGERR(1, "no ZMQ messages received from monerod in the last " << dt << " seconds, check your monerod/p2pool/network/firewall setup!!!");
|
||||
}
|
||||
}
|
||||
|
||||
P2PServer::P2PClient::P2PClient()
|
||||
: m_peerId(0)
|
||||
, m_expectedMessage(MessageId::HANDSHAKE_CHALLENGE)
|
||||
|
|
|
@ -139,6 +139,7 @@ private:
|
|||
|
||||
void flush_cache();
|
||||
void download_missing_blocks();
|
||||
void check_zmq();
|
||||
void update_peer_connections();
|
||||
void update_peer_list();
|
||||
void save_peer_list_async();
|
||||
|
|
|
@ -173,6 +173,8 @@ void p2pool::handle_tx(TxMempoolData& tx)
|
|||
#if TEST_MEMPOOL_PICKING_ALGORITHM
|
||||
m_blockTemplate->update(m_minerData, *m_mempool, &m_params->m_wallet);
|
||||
#endif
|
||||
|
||||
m_zmqLastActive = time(nullptr);
|
||||
}
|
||||
|
||||
void p2pool::handle_miner_data(MinerData& data)
|
||||
|
@ -226,6 +228,8 @@ void p2pool::handle_miner_data(MinerData& data)
|
|||
else {
|
||||
update_block_template();
|
||||
}
|
||||
|
||||
m_zmqLastActive = time(nullptr);
|
||||
}
|
||||
|
||||
const char* BLOCK_FOUND = "\n\
|
||||
|
@ -288,6 +292,8 @@ void p2pool::handle_chain_main(ChainMain& data, const char* extra)
|
|||
}
|
||||
|
||||
api_update_network_stats();
|
||||
|
||||
m_zmqLastActive = time(nullptr);
|
||||
}
|
||||
|
||||
void p2pool::submit_block_async(uint32_t template_id, uint32_t nonce, uint32_t extra_nonce)
|
||||
|
|
|
@ -78,6 +78,8 @@ public:
|
|||
|
||||
bool get_difficulty_at_height(uint64_t height, difficulty_type& diff);
|
||||
|
||||
time_t zmq_last_active() const { return m_zmqLastActive; }
|
||||
|
||||
private:
|
||||
p2pool(const p2pool&) = delete;
|
||||
p2pool(p2pool&&) = delete;
|
||||
|
@ -167,6 +169,8 @@ private:
|
|||
uv_async_t m_submitBlockAsync;
|
||||
uv_async_t m_blockTemplateAsync;
|
||||
uv_async_t m_stopAsync;
|
||||
|
||||
time_t m_zmqLastActive = 0;
|
||||
};
|
||||
|
||||
} // namespace p2pool
|
||||
|
|
Loading…
Reference in a new issue