Updated version
This commit is contained in:
commit
9586e5805c
34 changed files with 721 additions and 630 deletions
|
@ -28,7 +28,6 @@
|
|||
#include <uv.h>
|
||||
|
||||
|
||||
#include "api/Api.h"
|
||||
#include "App.h"
|
||||
#include "backend/cpu/Cpu.h"
|
||||
#include "base/io/Console.h"
|
||||
|
|
|
@ -71,13 +71,12 @@ static void print_cpu(Config *)
|
|||
{
|
||||
const ICpuInfo *info = Cpu::info();
|
||||
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%zu)") " %sx64 %sAES %sAVX2",
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%zu)") " %sx64 %sAES",
|
||||
"CPU",
|
||||
info->brand(),
|
||||
info->packages(),
|
||||
info->isX64() ? GREEN_BOLD_S : RED_BOLD_S "-",
|
||||
info->hasAES() ? GREEN_BOLD_S : RED_BOLD_S "-",
|
||||
info->hasAVX2() ? GREEN_BOLD_S : RED_BOLD_S "-"
|
||||
info->hasAES() ? GREEN_BOLD_S : RED_BOLD_S "-"
|
||||
);
|
||||
# if defined(XMRIG_FEATURE_LIBCPUID) || defined (XMRIG_FEATURE_HWLOC)
|
||||
Log::print(WHITE_BOLD(" %-13s") BLACK_BOLD("L2:") WHITE_BOLD("%.1f MB") BLACK_BOLD(" L3:") WHITE_BOLD("%.1f MB")
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "api/requests/HttpApiRequest.h"
|
||||
#include "base/net/http/HttpData.h"
|
||||
#include "rapidjson/error/en.h"
|
||||
|
||||
|
||||
xmrig::HttpApiRequest::HttpApiRequest(const HttpData &req, bool restricted) :
|
||||
ApiRequest(SOURCE_HTTP, restricted),
|
||||
m_parsed(false),
|
||||
m_req(req),
|
||||
m_res(req.id()),
|
||||
m_url(req.url.c_str())
|
||||
{
|
||||
if (method() == METHOD_GET) {
|
||||
if (url() == "/1/summary" || url() == "/2/summary" || url() == "/api.json") {
|
||||
m_type = REQ_SUMMARY;
|
||||
}
|
||||
}
|
||||
|
||||
if (url().size() > 4) {
|
||||
if (memcmp(url().data(), "/2/", 3) == 0) {
|
||||
m_version = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const rapidjson::Value &xmrig::HttpApiRequest::json() const
|
||||
{
|
||||
return m_body;
|
||||
}
|
||||
|
||||
|
||||
xmrig::IApiRequest::Method xmrig::HttpApiRequest::method() const
|
||||
{
|
||||
return static_cast<IApiRequest::Method>(m_req.method);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HttpApiRequest::accept()
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
ApiRequest::accept();
|
||||
|
||||
if (!m_parsed && !m_req.body.empty()) {
|
||||
m_parsed = true;
|
||||
m_body.Parse<kParseCommentsFlag | kParseTrailingCommasFlag>(m_req.body.c_str());
|
||||
|
||||
if (m_body.HasParseError()) {
|
||||
reply().AddMember("error", StringRef(GetParseError_En(m_body.GetParseError())), doc().GetAllocator());;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HttpApiRequest::done(int status)
|
||||
{
|
||||
ApiRequest::done(status);
|
||||
|
||||
m_res.setStatus(status);
|
||||
m_res.end();
|
||||
}
|
|
@ -56,6 +56,7 @@ public:
|
|||
}
|
||||
|
||||
if (index() == 1 && job.index() == 0 && job == m_jobs[0]) {
|
||||
m_index = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,9 +143,9 @@ xmrig::CpuBackend::~CpuBackend()
|
|||
}
|
||||
|
||||
|
||||
std::pair<size_t, size_t> xmrig::CpuBackend::hugePages() const
|
||||
std::pair<unsigned, unsigned> xmrig::CpuBackend::hugePages() const
|
||||
{
|
||||
std::pair<size_t, size_t> pages(0, 0);
|
||||
std::pair<unsigned, unsigned> pages(0, 0);
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (d_ptr->algo.family() == Algorithm::RANDOM_X) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
CpuBackend(Controller *controller);
|
||||
~CpuBackend() override;
|
||||
|
||||
std::pair<size_t, size_t> hugePages() const;
|
||||
std::pair<unsigned, unsigned> hugePages() const;
|
||||
|
||||
protected:
|
||||
bool isEnabled() const override;
|
||||
|
|
|
@ -246,13 +246,14 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
|||
findByType(cache, HWLOC_OBJ_CORE, [&cores](hwloc_obj_t found) { cores.emplace_back(found); });
|
||||
|
||||
size_t L3 = cache->attr->cache.size;
|
||||
const bool L3_exclusive = isCacheExclusive(cache);
|
||||
size_t L2 = 0;
|
||||
int L2_associativity = 0;
|
||||
size_t extra = 0;
|
||||
const size_t scratchpad = algorithm.l3();
|
||||
int intensity = algorithm.maxIntensity() == 1 ? -1 : 1;
|
||||
|
||||
if (cache->attr->cache.depth == 3 && isCacheExclusive(cache)) {
|
||||
if (cache->attr->cache.depth == 3) {
|
||||
for (size_t i = 0; i < cache->arity; ++i) {
|
||||
hwloc_obj_t l2 = cache->children[i];
|
||||
if (!isCacheObject(l2) || l2->attr == nullptr) {
|
||||
|
@ -262,7 +263,7 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
|||
L2 += l2->attr->cache.size;
|
||||
L2_associativity = l2->attr->cache.associativity;
|
||||
|
||||
if (l2->attr->cache.size >= scratchpad) {
|
||||
if (L3_exclusive && l2->attr->cache.size >= scratchpad) {
|
||||
extra += scratchpad;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
|
||||
|
||||
#include "3rdparty/http-parser/http_parser.h"
|
||||
#include "api/Api.h"
|
||||
#include "api/interfaces/IApiListener.h"
|
||||
#include "api/requests/HttpApiRequest.h"
|
||||
#include "base/api/Api.h"
|
||||
#include "base/api/interfaces/IApiListener.h"
|
||||
#include "base/api/requests/HttpApiRequest.h"
|
||||
#include "base/kernel/Base.h"
|
||||
#include "base/tools/Buffer.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
|
||||
#ifdef XMRIG_FEATURE_HTTP
|
||||
# include "api/Httpd.h"
|
||||
# include "base/api/Httpd.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
|
||||
#include "3rdparty/http-parser/http_parser.h"
|
||||
#include "api/Api.h"
|
||||
#include "api/Httpd.h"
|
||||
#include "base/api/Api.h"
|
||||
#include "base/api/Httpd.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/net/http/HttpApiResponse.h"
|
||||
#include "base/net/http/HttpData.h"
|
|
@ -54,16 +54,28 @@ public:
|
|||
|
||||
enum RequestType {
|
||||
REQ_UNKNOWN,
|
||||
REQ_SUMMARY
|
||||
REQ_SUMMARY,
|
||||
REQ_JSON_RPC
|
||||
};
|
||||
|
||||
|
||||
enum ErrorCode : int {
|
||||
RPC_PARSE_ERROR = -32700,
|
||||
RPC_INVALID_REQUEST = -32600,
|
||||
RPC_METHOD_NOT_FOUND = -32601,
|
||||
RPC_INVALID_PARAMS = -32602
|
||||
};
|
||||
|
||||
|
||||
virtual ~IApiRequest() = default;
|
||||
|
||||
virtual bool accept() = 0;
|
||||
virtual bool hasParseError() const = 0;
|
||||
virtual bool isDone() const = 0;
|
||||
virtual bool isNew() const = 0;
|
||||
virtual bool isRestricted() const = 0;
|
||||
virtual const rapidjson::Value &json() const = 0;
|
||||
virtual const String &rpcMethod() const = 0;
|
||||
virtual const String &url() const = 0;
|
||||
virtual int version() const = 0;
|
||||
virtual Method method() const = 0;
|
||||
|
@ -71,7 +83,6 @@ public:
|
|||
virtual rapidjson::Value &reply() = 0;
|
||||
virtual RequestType type() const = 0;
|
||||
virtual Source source() const = 0;
|
||||
virtual void accept() = 0;
|
||||
virtual void done(int status) = 0;
|
||||
};
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "api/requests/ApiRequest.h"
|
||||
#include "base/api/requests/ApiRequest.h"
|
||||
|
||||
|
||||
xmrig::ApiRequest::ApiRequest(Source source, bool restricted) :
|
|
@ -27,7 +27,8 @@
|
|||
#define XMRIG_APIREQUEST_H
|
||||
|
||||
|
||||
#include "api/interfaces/IApiRequest.h"
|
||||
#include "base/api/interfaces/IApiRequest.h"
|
||||
#include "base/tools/String.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
@ -40,28 +41,30 @@ public:
|
|||
~ApiRequest() override;
|
||||
|
||||
protected:
|
||||
inline bool isDone() const override { return m_state == STATE_DONE; }
|
||||
inline bool isNew() const override { return m_state == STATE_NEW; }
|
||||
inline bool isRestricted() const override { return m_restricted; }
|
||||
inline int version() const override { return m_version; }
|
||||
inline RequestType type() const override { return m_type; }
|
||||
inline Source source() const override { return m_source; }
|
||||
inline void accept() override { m_state = STATE_ACCEPTED; }
|
||||
inline void done(int) override { m_state = STATE_DONE; }
|
||||
|
||||
int m_version = 1;
|
||||
RequestType m_type = REQ_UNKNOWN;
|
||||
|
||||
private:
|
||||
enum State {
|
||||
STATE_NEW,
|
||||
STATE_ACCEPTED,
|
||||
STATE_DONE
|
||||
};
|
||||
|
||||
inline bool accept() override { m_state = STATE_ACCEPTED; return true; }
|
||||
inline bool isDone() const override { return m_state == STATE_DONE; }
|
||||
inline bool isNew() const override { return m_state == STATE_NEW; }
|
||||
inline bool isRestricted() const override { return m_restricted; }
|
||||
inline const String &rpcMethod() const override { return m_rpcMethod; }
|
||||
inline int version() const override { return m_version; }
|
||||
inline RequestType type() const override { return m_type; }
|
||||
inline Source source() const override { return m_source; }
|
||||
inline void done(int) override { m_state = STATE_DONE; }
|
||||
|
||||
int m_version = 1;
|
||||
RequestType m_type = REQ_UNKNOWN;
|
||||
State m_state = STATE_NEW;
|
||||
String m_rpcMethod;
|
||||
|
||||
private:
|
||||
bool m_restricted;
|
||||
Source m_source;
|
||||
State m_state = STATE_NEW;
|
||||
};
|
||||
|
||||
|
178
src/base/api/requests/HttpApiRequest.cpp
Normal file
178
src/base/api/requests/HttpApiRequest.cpp
Normal file
|
@ -0,0 +1,178 @@
|
|||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "3rdparty/http-parser/http_parser.h"
|
||||
#include "base/api/requests/HttpApiRequest.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "base/net/http/HttpData.h"
|
||||
#include "rapidjson/error/en.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static const char *kError = "error";
|
||||
static const char *kId = "id";
|
||||
static const char *kResult = "result";
|
||||
|
||||
|
||||
static inline const char *rpcError(int code) {
|
||||
switch (code) {
|
||||
case IApiRequest::RPC_PARSE_ERROR:
|
||||
return "Parse error";
|
||||
|
||||
case IApiRequest::RPC_INVALID_REQUEST:
|
||||
return "Invalid Request";
|
||||
|
||||
case IApiRequest::RPC_METHOD_NOT_FOUND:
|
||||
return "Method not found";
|
||||
|
||||
case IApiRequest::RPC_INVALID_PARAMS:
|
||||
return "Invalid params";
|
||||
}
|
||||
|
||||
return "Internal error";
|
||||
}
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
xmrig::HttpApiRequest::HttpApiRequest(const HttpData &req, bool restricted) :
|
||||
ApiRequest(SOURCE_HTTP, restricted),
|
||||
m_req(req),
|
||||
m_res(req.id()),
|
||||
m_url(req.url.c_str())
|
||||
{
|
||||
if (method() == METHOD_GET) {
|
||||
if (url() == "/1/summary" || url() == "/2/summary" || url() == "/api.json") {
|
||||
m_type = REQ_SUMMARY;
|
||||
}
|
||||
}
|
||||
|
||||
if (method() == METHOD_POST && url() == "/json_rpc") {
|
||||
m_type = REQ_JSON_RPC;
|
||||
accept();
|
||||
|
||||
if (hasParseError()) {
|
||||
done(RPC_PARSE_ERROR);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_rpcMethod = Json::getString(json(), "method");
|
||||
if (m_rpcMethod.isEmpty()) {
|
||||
done(RPC_INVALID_REQUEST);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_state = STATE_NEW;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (url().size() > 4) {
|
||||
if (memcmp(url().data(), "/2/", 3) == 0) {
|
||||
m_version = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::HttpApiRequest::accept()
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
ApiRequest::accept();
|
||||
|
||||
if (m_parsed == 0 && !m_req.body.empty()) {
|
||||
m_body.Parse<kParseCommentsFlag | kParseTrailingCommasFlag>(m_req.body.c_str());
|
||||
m_parsed = m_body.HasParseError() ? 2 : 1;
|
||||
|
||||
if (!hasParseError()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type() != REQ_JSON_RPC) {
|
||||
reply().AddMember(StringRef(kError), StringRef(GetParseError_En(m_body.GetParseError())), doc().GetAllocator());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return hasParseError();
|
||||
}
|
||||
|
||||
|
||||
const rapidjson::Value &xmrig::HttpApiRequest::json() const
|
||||
{
|
||||
return m_body;
|
||||
}
|
||||
|
||||
|
||||
xmrig::IApiRequest::Method xmrig::HttpApiRequest::method() const
|
||||
{
|
||||
return static_cast<IApiRequest::Method>(m_req.method);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HttpApiRequest::done(int status)
|
||||
{
|
||||
ApiRequest::done(status);
|
||||
|
||||
if (type() == REQ_JSON_RPC) {
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc().GetAllocator();
|
||||
|
||||
m_res.setStatus(HTTP_STATUS_OK);
|
||||
|
||||
if (status != HTTP_STATUS_OK) {
|
||||
if (status == HTTP_STATUS_NOT_FOUND) {
|
||||
status = RPC_METHOD_NOT_FOUND;
|
||||
}
|
||||
|
||||
Value error(kObjectType);
|
||||
error.AddMember("code", status, allocator);
|
||||
error.AddMember("message", StringRef(rpcError(status)), allocator);
|
||||
|
||||
reply().AddMember(StringRef(kError), error, allocator);
|
||||
}
|
||||
else if (!reply().HasMember(kResult)) {
|
||||
Value result(kObjectType);
|
||||
result.AddMember("status", "OK", allocator);
|
||||
|
||||
reply().AddMember(StringRef(kResult), result, allocator);
|
||||
}
|
||||
|
||||
reply().AddMember("jsonrpc", "2.0", allocator);
|
||||
reply().AddMember(StringRef(kId), Value().CopyFrom(Json::getValue(json(), kId), allocator), allocator);
|
||||
}
|
||||
else {
|
||||
m_res.setStatus(status);
|
||||
}
|
||||
|
||||
m_res.end();
|
||||
}
|
|
@ -27,7 +27,7 @@
|
|||
#define XMRIG_HTTPAPIREQUEST_H
|
||||
|
||||
|
||||
#include "api/requests/ApiRequest.h"
|
||||
#include "base/api/requests/ApiRequest.h"
|
||||
#include "base/net/http/HttpApiResponse.h"
|
||||
#include "base/tools/String.h"
|
||||
|
||||
|
@ -44,19 +44,20 @@ public:
|
|||
HttpApiRequest(const HttpData &req, bool restricted);
|
||||
|
||||
protected:
|
||||
inline bool hasParseError() const override { return m_parsed == 2; }
|
||||
inline const String &url() const override { return m_url; }
|
||||
inline rapidjson::Document &doc() override { return m_res.doc(); }
|
||||
inline rapidjson::Value &reply() override { return m_res.doc(); }
|
||||
inline const String &url() const override { return m_url; }
|
||||
|
||||
bool accept() override;
|
||||
const rapidjson::Value &json() const override;
|
||||
Method method() const override;
|
||||
void accept() override;
|
||||
void done(int status) override;
|
||||
|
||||
private:
|
||||
bool m_parsed;
|
||||
const HttpData &m_req;
|
||||
HttpApiResponse m_res;
|
||||
int m_parsed = 0;
|
||||
rapidjson::Document m_body;
|
||||
String m_url;
|
||||
};
|
|
@ -1,4 +1,5 @@
|
|||
set(HEADERS_BASE
|
||||
src/base/api/interfaces/IApiListener.h
|
||||
src/base/io/Console.h
|
||||
src/base/io/json/Json.h
|
||||
src/base/io/json/JsonChain.h
|
||||
|
@ -114,6 +115,11 @@ endif()
|
|||
if (WITH_HTTP)
|
||||
set(HEADERS_BASE_HTTP
|
||||
src/3rdparty/http-parser/http_parser.h
|
||||
src/base/api/Api.h
|
||||
src/base/api/Httpd.h
|
||||
src/base/api/interfaces/IApiRequest.h
|
||||
src/base/api/requests/ApiRequest.h
|
||||
src/base/api/requests/HttpApiRequest.h
|
||||
src/base/kernel/interfaces/IHttpListener.h
|
||||
src/base/kernel/interfaces/IJsonReader.h
|
||||
src/base/kernel/interfaces/ITcpServerListener.h
|
||||
|
@ -129,6 +135,10 @@ if (WITH_HTTP)
|
|||
|
||||
set(SOURCES_BASE_HTTP
|
||||
src/3rdparty/http-parser/http_parser.c
|
||||
src/base/api/Api.cpp
|
||||
src/base/api/Httpd.cpp
|
||||
src/base/api/requests/ApiRequest.cpp
|
||||
src/base/api/requests/HttpApiRequest.cpp
|
||||
src/base/net/http/HttpApiResponse.cpp
|
||||
src/base/net/http/HttpClient.cpp
|
||||
src/base/net/http/HttpContext.cpp
|
||||
|
|
|
@ -47,15 +47,8 @@
|
|||
|
||||
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
# include "api/Api.h"
|
||||
# include "api/interfaces/IApiRequest.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_EMBEDDED_CONFIG
|
||||
# include "core/config/Config_default.h"
|
||||
#endif
|
||||
|
||||
# include "base/api/Api.h"
|
||||
# include "base/api/interfaces/IApiRequest.h"
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
@ -63,6 +56,12 @@ static const char *kConfigPathV1 = "/1/config";
|
|||
static const char *kConfigPathV2 = "/2/config";
|
||||
|
||||
} // namespace xmrig
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_EMBEDDED_CONFIG
|
||||
# include "core/config/Config_default.h"
|
||||
#endif
|
||||
|
||||
|
||||
class xmrig::BasePrivate
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#define XMRIG_BASE_H
|
||||
|
||||
|
||||
#include "api/interfaces/IApiListener.h"
|
||||
#include "base/api/interfaces/IApiListener.h"
|
||||
#include "base/kernel/interfaces/IConfigListener.h"
|
||||
#include "base/kernel/interfaces/IWatcherListener.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
|
||||
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
# include "api/Api.h"
|
||||
# include "api/interfaces/IApiRequest.h"
|
||||
# include "base/api/Api.h"
|
||||
# include "base/api/interfaces/IApiRequest.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -477,5 +477,17 @@ void xmrig::Miner::onRequest(IApiRequest &request)
|
|||
d_ptr->getBackends(request.reply(), request.doc());
|
||||
}
|
||||
}
|
||||
else if (request.type() == IApiRequest::REQ_JSON_RPC) {
|
||||
if (request.rpcMethod() == "pause") {
|
||||
request.accept();
|
||||
|
||||
setEnabled(false);
|
||||
}
|
||||
else if (request.rpcMethod() == "resume") {
|
||||
request.accept();
|
||||
|
||||
setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <vector>
|
||||
|
||||
|
||||
#include "api/interfaces/IApiListener.h"
|
||||
#include "base/api/interfaces/IApiListener.h"
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
#include "base/kernel/interfaces/ITimerListener.h"
|
||||
#include "crypto/common/Algorithm.h"
|
||||
|
|
|
@ -250,9 +250,9 @@ xmrig::RxDataset *xmrig::Rx::dataset(const Job &job, uint32_t nodeId)
|
|||
}
|
||||
|
||||
|
||||
std::pair<size_t, size_t> xmrig::Rx::hugePages()
|
||||
std::pair<unsigned, unsigned> xmrig::Rx::hugePages()
|
||||
{
|
||||
std::pair<size_t, size_t> pages(0, 0);
|
||||
std::pair<unsigned, unsigned> pages(0, 0);
|
||||
std::lock_guard<std::mutex> lock(d_ptr->mutex);
|
||||
|
||||
for (auto const &item : d_ptr->datasets) {
|
||||
|
|
|
@ -46,7 +46,7 @@ class Rx
|
|||
public:
|
||||
static bool isReady(const Job &job);
|
||||
static RxDataset *dataset(const Job &job, uint32_t nodeId);
|
||||
static std::pair<size_t, size_t> hugePages();
|
||||
static std::pair<unsigned, unsigned> hugePages();
|
||||
static void destroy();
|
||||
static void init();
|
||||
static void init(const Job &job, int initThreads, bool hugePages, bool numa);
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <time.h>
|
||||
|
||||
|
||||
#include "api/Api.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/net/stratum/Client.h"
|
||||
#include "base/net/stratum/SubmitResult.h"
|
||||
|
@ -51,8 +50,8 @@
|
|||
|
||||
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
# include "api/Api.h"
|
||||
# include "api/interfaces/IApiRequest.h"
|
||||
# include "base/api/Api.h"
|
||||
# include "base/api/interfaces/IApiRequest.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <vector>
|
||||
|
||||
|
||||
#include "api/interfaces/IApiListener.h"
|
||||
#include "base/api/interfaces/IApiListener.h"
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
#include "base/kernel/interfaces/IStrategyListener.h"
|
||||
#include "base/kernel/interfaces/ITimerListener.h"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "XMRig CPU miner"
|
||||
#define APP_VERSION "2.99.5-beta-mo1"
|
||||
#define APP_VERSION "2.99.6-beta-mo1"
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#define APP_VER_MAJOR 2
|
||||
#define APP_VER_MINOR 99
|
||||
#define APP_VER_PATCH 5
|
||||
#define APP_VER_PATCH 6
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if (_MSC_VER >= 1920)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue