mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 19:39:22 +00:00
Force update average hashrates when print_status() is called
This commit is contained in:
parent
d1e94d6e1a
commit
891ee36e53
2 changed files with 9 additions and 7 deletions
|
@ -338,6 +338,12 @@ uint64_t StratumServer::get_random64()
|
|||
return m_rng();
|
||||
}
|
||||
|
||||
void StratumServer::print_status()
|
||||
{
|
||||
update_hashrate_data(0);
|
||||
print_stratum_status();
|
||||
}
|
||||
|
||||
void StratumServer::print_stratum_status() const
|
||||
{
|
||||
uint64_t hashes_15m, hashes_1h, hashes_24h, total_hashes;
|
||||
|
@ -478,14 +484,10 @@ void StratumServer::on_blobs_ready()
|
|||
|
||||
void StratumServer::update_hashrate_data(uint64_t target)
|
||||
{
|
||||
if (target <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const time_t timestamp = time(nullptr);
|
||||
|
||||
uint64_t hashes, rem;
|
||||
hashes = udiv128(1, 0, target, &rem);
|
||||
uint64_t rem;
|
||||
const uint64_t hashes = (target > 1) ? udiv128(1, 0, target, &rem) : 0;
|
||||
|
||||
WriteLock lock(m_hashrateDataLock);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
bool on_submit(StratumClient* client, uint32_t id, const char* job_id_str, const char* nonce_str, const char* result_str);
|
||||
uint64_t get_random64();
|
||||
|
||||
void print_status() override { print_stratum_status(); }
|
||||
void print_status() override;
|
||||
|
||||
private:
|
||||
void print_stratum_status() const;
|
||||
|
|
Loading…
Reference in a new issue