Merged v4.5.0-beta
This commit is contained in:
commit
c208f8eb8f
79 changed files with 3704 additions and 161 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <memory>
|
||||
|
||||
|
||||
#include "backend/common/Tags.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/net/stratum/Client.h"
|
||||
#include "base/net/stratum/SubmitResult.h"
|
||||
|
@ -55,6 +56,22 @@
|
|||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static const char *tag = BLUE_BG_BOLD(WHITE_BOLD_S " net ");
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
|
||||
const char *xmrig::net_tag()
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
xmrig::Network::Network(Controller *controller) :
|
||||
m_controller(controller),
|
||||
m_donate(nullptr),
|
||||
|
@ -97,19 +114,19 @@ void xmrig::Network::connect()
|
|||
void xmrig::Network::onActive(IStrategy *strategy, IClient *client)
|
||||
{
|
||||
if (m_donate && m_donate == strategy) {
|
||||
LOG_NOTICE("dev donate started");
|
||||
LOG_NOTICE("%s " WHITE_BOLD("dev donate started"), tag);
|
||||
return;
|
||||
}
|
||||
|
||||
m_state.onActive(client);
|
||||
|
||||
const char *tlsVersion = client->tlsVersion();
|
||||
LOG_INFO(WHITE_BOLD("use %s ") CYAN_BOLD("%s:%d ") GREEN_BOLD("%s") " " BLACK_BOLD("%s"),
|
||||
client->mode(), client->pool().host().data(), client->pool().port(), tlsVersion ? tlsVersion : "", client->ip().data());
|
||||
LOG_INFO("%s " WHITE_BOLD("use %s ") CYAN_BOLD("%s:%d ") GREEN_BOLD("%s") " " BLACK_BOLD("%s"),
|
||||
tag, client->mode(), client->pool().host().data(), client->pool().port(), tlsVersion ? tlsVersion : "", client->ip().data());
|
||||
|
||||
const char *fingerprint = client->tlsFingerprint();
|
||||
if (fingerprint != nullptr) {
|
||||
LOG_INFO(BLACK_BOLD("fingerprint (SHA-256): \"%s\""), fingerprint);
|
||||
LOG_INFO("%s " BLACK_BOLD("fingerprint (SHA-256): \"%s\""), tag, fingerprint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,12 +203,12 @@ void xmrig::Network::onLogin(IStrategy *, IClient *client, rapidjson::Document &
|
|||
void xmrig::Network::onPause(IStrategy *strategy)
|
||||
{
|
||||
if (m_donate && m_donate == strategy) {
|
||||
LOG_NOTICE("dev donate finished");
|
||||
LOG_NOTICE("%s " WHITE_BOLD("dev donate finished"), tag);
|
||||
m_strategy->resume();
|
||||
}
|
||||
|
||||
if (!m_strategy->isActive()) {
|
||||
LOG_ERR("no active pools, stop mining");
|
||||
LOG_ERR("%s " RED("no active pools, stop mining"), tag);
|
||||
m_state.stop();
|
||||
|
||||
return m_controller->miner()->pause();
|
||||
|
@ -204,12 +221,12 @@ void xmrig::Network::onResultAccepted(IStrategy *, IClient *, const SubmitResult
|
|||
m_state.add(result, error);
|
||||
|
||||
if (error) {
|
||||
LOG_INFO(RED_BOLD("rejected") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64) " " RED("\"%s\"") " " BLACK_BOLD("(%" PRIu64 " ms)"),
|
||||
m_state.accepted, m_state.rejected, result.diff, error, result.elapsed);
|
||||
LOG_INFO("%s " RED_BOLD("rejected") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64) " " RED("\"%s\"") " " BLACK_BOLD("(%" PRIu64 " ms)"),
|
||||
backend_tag(result.backend), m_state.accepted, m_state.rejected, result.diff, error, result.elapsed);
|
||||
}
|
||||
else {
|
||||
LOG_INFO(GREEN_BOLD("accepted") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64) " " BLACK_BOLD("(%" PRIu64 " ms)"),
|
||||
m_state.accepted, m_state.rejected, result.diff, result.elapsed);
|
||||
LOG_INFO("%s " GREEN_BOLD("accepted") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64) " " BLACK_BOLD("(%" PRIu64 " ms)"),
|
||||
backend_tag(result.backend), m_state.accepted, m_state.rejected, result.diff, result.elapsed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,12 +257,12 @@ void xmrig::Network::onRequest(IApiRequest &request)
|
|||
void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
|
||||
{
|
||||
if (job.height()) {
|
||||
LOG_INFO(MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
||||
client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName(), job.height());
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
||||
tag, client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName(), job.height());
|
||||
}
|
||||
else {
|
||||
LOG_INFO(MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s"),
|
||||
client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName());
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s"),
|
||||
tag, client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName());
|
||||
}
|
||||
|
||||
if (!donate && m_donate) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue