Don't update api when shutting down

This commit is contained in:
SChernykh 2023-09-13 21:12:01 +02:00
parent b83b691714
commit 2248739dd5
4 changed files with 8 additions and 8 deletions

View file

@ -119,7 +119,7 @@ void Miner::on_block(const BlockTemplate& block)
m_nonceTimestamp = cur_ts;
m_totalHashes += hash_count;
if (m_pool->api() && m_pool->params().m_localStats) {
if (m_pool->api() && m_pool->params().m_localStats && !m_pool->stopped()) {
const double block_reward_share_percent = m_pool->side_chain().get_reward_share(m_pool->params().m_wallet) * 100.0;
m_pool->api()->set(p2pool_api::Category::LOCAL, "miner",

View file

@ -1305,7 +1305,7 @@ void P2PServer::on_shutdown()
void P2PServer::api_update_local_stats()
{
if (!m_pool->api() || !m_pool->params().m_localStats || ((m_timerCounter % 30) != 5)) {
if (!m_pool->api() || !m_pool->params().m_localStats || m_pool->stopped() || ((m_timerCounter % 30) != 5)) {
return;
}

View file

@ -925,7 +925,7 @@ void p2pool::get_info()
void p2pool::load_found_blocks()
{
if (!m_api) {
if (!m_api || m_stopped) {
return;
}
@ -1277,7 +1277,7 @@ uint32_t p2pool::parse_block_headers_range(const char* data, size_t size)
void p2pool::api_update_network_stats()
{
if (!m_api) {
if (!m_api || m_stopped) {
return;
}
@ -1308,7 +1308,7 @@ void p2pool::api_update_network_stats()
void p2pool::api_update_pool_stats()
{
if (!m_api) {
if (!m_api || m_stopped) {
return;
}
@ -1360,7 +1360,7 @@ void p2pool::api_update_pool_stats()
void p2pool::api_update_stats_mod()
{
if (!m_api) {
if (!m_api || m_stopped) {
return;
}
@ -1453,7 +1453,7 @@ void p2pool::cleanup_mainchain_data(uint64_t height)
void p2pool::api_update_block_found(const ChainMain* data, const PoolBlock* block)
{
if (!m_api) {
if (!m_api || m_stopped) {
return;
}

View file

@ -1274,7 +1274,7 @@ bool StratumServer::StratumClient::process_submit(rapidjson::Document& doc, uint
void StratumServer::api_update_local_stats(uint64_t timestamp)
{
if (!m_pool->api() || !m_pool->params().m_localStats) {
if (!m_pool->api() || !m_pool->params().m_localStats || m_pool->stopped()) {
return;
}