mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
Return current algorithm in API response.
This commit is contained in:
parent
378bc504fc
commit
a000544fdc
6 changed files with 8 additions and 4 deletions
|
@ -144,7 +144,6 @@ void xmrig::ApiRouter::getMiner(rapidjson::Value &reply, rapidjson::Document &do
|
||||||
reply.AddMember("kind", APP_KIND, allocator);
|
reply.AddMember("kind", APP_KIND, allocator);
|
||||||
reply.AddMember("ua", StringRef(Platform::userAgent()), allocator);
|
reply.AddMember("ua", StringRef(Platform::userAgent()), allocator);
|
||||||
reply.AddMember("cpu", cpu, 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("hugepages", Workers::hugePages() > 0, allocator);
|
||||||
reply.AddMember("donate_level", m_base->config()->pools().donateLevel(), allocator);
|
reply.AddMember("donate_level", m_base->config()->pools().donateLevel(), allocator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ void xmrig::FailoverStrategy::add(const Pool &pool)
|
||||||
|
|
||||||
int64_t xmrig::FailoverStrategy::submit(const JobResult &result)
|
int64_t xmrig::FailoverStrategy::submit(const JobResult &result)
|
||||||
{
|
{
|
||||||
if (m_active == -1) {
|
if (!isActive()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline bool isActive() const override { return m_active >= 0; }
|
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 {}
|
inline void onLogin(IClient *, rapidjson::Document &, rapidjson::Value &) override {}
|
||||||
|
|
||||||
int64_t submit(const JobResult &result) override;
|
int64_t submit(const JobResult &result) override;
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
|
|
||||||
|
|
||||||
xmrig::Network::Network(Controller *controller) :
|
xmrig::Network::Network(Controller *controller) :
|
||||||
|
m_controller(controller),
|
||||||
m_donate(nullptr),
|
m_donate(nullptr),
|
||||||
m_timer(nullptr)
|
m_timer(nullptr)
|
||||||
{
|
{
|
||||||
|
@ -230,6 +231,9 @@ void xmrig::Network::getConnection(rapidjson::Value &reply, rapidjson::Document
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
auto &allocator = doc.GetAllocator();
|
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);
|
Value connection(kObjectType);
|
||||||
connection.AddMember("pool", StringRef(m_state.pool), allocator);
|
connection.AddMember("pool", StringRef(m_state.pool), allocator);
|
||||||
connection.AddMember("uptime", m_state.connectionTime(), allocator);
|
connection.AddMember("uptime", m_state.connectionTime(), allocator);
|
||||||
|
|
|
@ -78,6 +78,7 @@ private:
|
||||||
void getResults(rapidjson::Value &reply, rapidjson::Document &doc) const;
|
void getResults(rapidjson::Value &reply, rapidjson::Document &doc) const;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
Controller *m_controller;
|
||||||
IStrategy *m_donate;
|
IStrategy *m_donate;
|
||||||
IStrategy *m_strategy;
|
IStrategy *m_strategy;
|
||||||
NetworkState m_state;
|
NetworkState m_state;
|
||||||
|
|
|
@ -92,7 +92,7 @@ void xmrig::NetworkState::add(const SubmitResult &result, const char *error)
|
||||||
std::sort(topDiff.rbegin(), topDiff.rend());
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue