Tweaked `status` code

Don't create stream when it's not needed
pull/271/head
SChernykh 11 months ago
parent 396479c2bf
commit 5444701c38

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

@ -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)) {
if (client->m_listenPort >= 0) {
char buf[32] = {};
log::Stream s(buf);
if (client->m_SoftwareVersion) {
log::Stream s(buf);
s << client->software_name() << " v" << (client->m_SoftwareVersion >> 16) << '.' << (client->m_SoftwareVersion & 0xFFFF);
}
LOGINFO(0, (client->m_isIncoming ? "I\t" : "O\t")

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

Loading…
Cancel
Save