diff --git a/src/api/v1/ApiRouter.cpp b/src/api/v1/ApiRouter.cpp index 91395939c..d066b0b1e 100644 --- a/src/api/v1/ApiRouter.cpp +++ b/src/api/v1/ApiRouter.cpp @@ -144,7 +144,6 @@ void xmrig::ApiRouter::getMiner(rapidjson::Value &reply, rapidjson::Document &do reply.AddMember("kind", APP_KIND, allocator); reply.AddMember("ua", StringRef(Platform::userAgent()), allocator); reply.AddMember("cpu", cpu, allocator); - reply.AddMember("algo", StringRef(m_base->config()->algorithm().shortName()), allocator); reply.AddMember("hugepages", Workers::hugePages() > 0, allocator); reply.AddMember("donate_level", m_base->config()->pools().donateLevel(), allocator); } diff --git a/src/base/net/stratum/strategies/FailoverStrategy.cpp b/src/base/net/stratum/strategies/FailoverStrategy.cpp index b89cd955a..d52472293 100644 --- a/src/base/net/stratum/strategies/FailoverStrategy.cpp +++ b/src/base/net/stratum/strategies/FailoverStrategy.cpp @@ -89,7 +89,7 @@ void xmrig::FailoverStrategy::add(const Pool &pool) int64_t xmrig::FailoverStrategy::submit(const JobResult &result) { - if (m_active == -1) { + if (!isActive()) { return -1; } diff --git a/src/base/net/stratum/strategies/FailoverStrategy.h b/src/base/net/stratum/strategies/FailoverStrategy.h index 344d815c0..b1fe8bace 100644 --- a/src/base/net/stratum/strategies/FailoverStrategy.h +++ b/src/base/net/stratum/strategies/FailoverStrategy.h @@ -52,7 +52,7 @@ public: protected: inline bool isActive() const override { return m_active >= 0; } - inline IClient *client() const override { return active(); } + inline IClient *client() const override { return isActive() ? active() : m_pools[m_index]; } inline void onLogin(IClient *, rapidjson::Document &, rapidjson::Value &) override {} int64_t submit(const JobResult &result) override; diff --git a/src/net/Network.cpp b/src/net/Network.cpp index cc5d59e40..32cad6a6e 100644 --- a/src/net/Network.cpp +++ b/src/net/Network.cpp @@ -53,6 +53,7 @@ xmrig::Network::Network(Controller *controller) : + m_controller(controller), m_donate(nullptr), m_timer(nullptr) { @@ -230,6 +231,9 @@ void xmrig::Network::getConnection(rapidjson::Value &reply, rapidjson::Document using namespace rapidjson; auto &allocator = doc.GetAllocator(); + const Algorithm &algo = m_strategy->client()->job().algorithm(); + reply.AddMember("algo", StringRef((algo.isValid() ? algo : m_controller->config()->algorithm()).shortName()), allocator); + Value connection(kObjectType); connection.AddMember("pool", StringRef(m_state.pool), allocator); connection.AddMember("uptime", m_state.connectionTime(), allocator); diff --git a/src/net/Network.h b/src/net/Network.h index 079d997a4..eaec9472f 100644 --- a/src/net/Network.h +++ b/src/net/Network.h @@ -78,6 +78,7 @@ private: void getResults(rapidjson::Value &reply, rapidjson::Document &doc) const; # endif + Controller *m_controller; IStrategy *m_donate; IStrategy *m_strategy; NetworkState m_state; diff --git a/src/net/NetworkState.cpp b/src/net/NetworkState.cpp index c55422db7..e495773a8 100644 --- a/src/net/NetworkState.cpp +++ b/src/net/NetworkState.cpp @@ -92,7 +92,7 @@ void xmrig::NetworkState::add(const SubmitResult &result, const char *error) std::sort(topDiff.rbegin(), topDiff.rend()); } - m_latency.push_back(result.elapsed > 0xFFFF ? 0xFFFF : (uint16_t) result.elapsed); + m_latency.push_back(result.elapsed > 0xFFFF ? 0xFFFF : static_cast(result.elapsed)); }