Return current algorithm in API response.

This commit is contained in:
XMRig 2019-05-01 22:07:13 +07:00
parent 378bc504fc
commit a000544fdc
6 changed files with 8 additions and 4 deletions

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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<uint16_t>(result.elapsed));
}