Tweaked status code

Don't create stream when it's not needed
This commit is contained in:
SChernykh 2023-07-02 15:33:51 +02:00
parent 396479c2bf
commit 5444701c38
3 changed files with 3 additions and 3 deletions

View file

@ -85,11 +85,11 @@ void Miner::print_status()
const uint64_t hr = (dt > 0.0) ? static_cast<uint64_t>(hash_count / dt) : 0; const uint64_t hr = (dt > 0.0) ? static_cast<uint64_t>(hash_count / dt) : 0;
char shares_failed_buf[64] = {}; char shares_failed_buf[64] = {};
log::Stream s(shares_failed_buf);
const uint32_t shares_found = m_sharesFound; const uint32_t shares_found = m_sharesFound;
const uint32_t shares_failed = m_sharesFailed; const uint32_t shares_failed = m_sharesFailed;
if (shares_failed) { if (shares_failed) {
log::Stream s(shares_failed_buf);
s << log::Yellow() << "\nShares failed = " << shares_failed << log::NoColor(); s << log::Yellow() << "\nShares failed = " << shares_failed << log::NoColor();
} }

View file

@ -986,8 +986,8 @@ void P2PServer::show_peers() const
for (P2PClient* client = static_cast<P2PClient*>(m_connectedClientsList->m_next); client != m_connectedClientsList; client = static_cast<P2PClient*>(client->m_next)) { for (P2PClient* client = static_cast<P2PClient*>(m_connectedClientsList->m_next); client != m_connectedClientsList; client = static_cast<P2PClient*>(client->m_next)) {
if (client->m_listenPort >= 0) { if (client->m_listenPort >= 0) {
char buf[32] = {}; char buf[32] = {};
log::Stream s(buf);
if (client->m_SoftwareVersion) { if (client->m_SoftwareVersion) {
log::Stream s(buf);
s << client->software_name() << " v" << (client->m_SoftwareVersion >> 16) << '.' << (client->m_SoftwareVersion & 0xFFFF); s << client->software_name() << " v" << (client->m_SoftwareVersion >> 16) << '.' << (client->m_SoftwareVersion & 0xFFFF);
} }
LOGINFO(0, (client->m_isIncoming ? "I\t" : "O\t") LOGINFO(0, (client->m_isIncoming ? "I\t" : "O\t")

View file

@ -589,8 +589,8 @@ void StratumServer::print_stratum_status() const
const uint64_t hashrate_24h = (dt_24h > 0) ? (hashes_24h / dt_24h) : 0; const uint64_t hashrate_24h = (dt_24h > 0) ? (hashes_24h / dt_24h) : 0;
char shares_failed_buf[64] = {}; char shares_failed_buf[64] = {};
log::Stream s(shares_failed_buf);
if (shares_failed) { if (shares_failed) {
log::Stream s(shares_failed_buf);
s << log::Yellow() << "\nShares failed = " << shares_failed << log::NoColor(); s << log::Yellow() << "\nShares failed = " << shares_failed << log::NoColor();
} }