mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 11:29:23 +00:00
Check for updates in status
and version
commands
This commit is contained in:
parent
4e55f53fb4
commit
7a65e1feb5
4 changed files with 22 additions and 7 deletions
|
@ -202,13 +202,20 @@ static void do_status(p2pool *m_pool, const char * /* args */)
|
|||
if (m_pool->stratum_server()) {
|
||||
m_pool->stratum_server()->print_status();
|
||||
}
|
||||
if (m_pool->p2p_server()) {
|
||||
m_pool->p2p_server()->print_status();
|
||||
|
||||
P2PServer* p2p = m_pool->p2p_server();
|
||||
if (p2p) {
|
||||
p2p->print_status();
|
||||
}
|
||||
|
||||
#ifdef WITH_RANDOMX
|
||||
m_pool->print_miner_status();
|
||||
#endif
|
||||
bkg_jobs_tracker.print_status();
|
||||
|
||||
if (p2p) {
|
||||
p2p->check_for_updates(true);
|
||||
}
|
||||
}
|
||||
|
||||
static void do_loglevel(p2pool * /* m_pool */, const char *args)
|
||||
|
@ -312,9 +319,14 @@ static void do_exit(p2pool *m_pool, const char * /* args */)
|
|||
m_pool->stop();
|
||||
}
|
||||
|
||||
static void do_version(p2pool* /* m_pool */, const char* /* args */)
|
||||
static void do_version(p2pool* m_pool, const char* /* args */)
|
||||
{
|
||||
LOGINFO(0, log::LightCyan() << VERSION);
|
||||
|
||||
const P2PServer* p2p = m_pool->p2p_server();
|
||||
if (p2p) {
|
||||
p2p->check_for_updates(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleCommands::allocCallback(uv_handle_t* handle, size_t /*suggested_size*/, uv_buf_t* buf)
|
||||
|
|
|
@ -1256,15 +1256,15 @@ void P2PServer::check_block_template()
|
|||
}
|
||||
}
|
||||
|
||||
void P2PServer::check_for_updates() const
|
||||
void P2PServer::check_for_updates(bool forced) const
|
||||
{
|
||||
if (m_timerCounter % (3600 / m_timerInterval) != 0) {
|
||||
if (!forced && (m_timerCounter % (3600 / m_timerInterval) != 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const SideChain& s = m_pool->side_chain();
|
||||
|
||||
if (s.precalcFinished() && s.p2pool_update_available()) {
|
||||
if ((forced || s.precalcFinished()) && s.p2pool_update_available()) {
|
||||
LOGINFO(0, log::LightCyan() << "********************************************************************************");
|
||||
LOGINFO(0, log::LightCyan() << "* An updated P2Pool version is available, visit p2pool.io for more information *");
|
||||
LOGINFO(0, log::LightCyan() << "********************************************************************************");
|
||||
|
|
|
@ -177,6 +177,8 @@ public:
|
|||
|
||||
const PoolBlock* find_block(const hash& id) const;
|
||||
|
||||
void check_for_updates(bool forced = false) const;
|
||||
|
||||
private:
|
||||
const char* get_log_category() const override;
|
||||
|
||||
|
@ -198,7 +200,6 @@ private:
|
|||
void download_missing_blocks();
|
||||
void check_host();
|
||||
void check_block_template();
|
||||
void check_for_updates() const;
|
||||
void update_peer_connections();
|
||||
void update_peer_list();
|
||||
void send_peer_list_request(P2PClient* client, uint64_t cur_time);
|
||||
|
|
|
@ -2160,6 +2160,8 @@ void SideChain::prune_old_blocks()
|
|||
|
||||
server1->show_workers_async();
|
||||
server2->show_peers_async();
|
||||
|
||||
server2->check_for_updates(true);
|
||||
}
|
||||
|
||||
m_pool->print_hosts();
|
||||
|
|
Loading…
Reference in a new issue