Merge of xmrig v6.5.0

This commit is contained in:
MoneroOcean 2020-11-02 15:08:16 +00:00
commit a57d1bbbda
86 changed files with 15293 additions and 490 deletions

View file

@ -1,9 +1,11 @@
set(HEADERS_BASE
src/3rdparty/fmt/format.cc
src/base/api/interfaces/IApiListener.h
src/base/crypto/Algorithm.h
src/base/crypto/Coin.h
src/base/crypto/keccak.h
src/base/crypto/sha3.h
src/base/io/Async.h
src/base/io/Console.h
src/base/io/Env.h
src/base/io/json/Json.h
@ -21,6 +23,7 @@ set(HEADERS_BASE
src/base/kernel/config/BaseTransform.h
src/base/kernel/config/Title.h
src/base/kernel/Entry.h
src/base/kernel/interfaces/IAsyncListener.h
src/base/kernel/interfaces/IBaseListener.h
src/base/kernel/interfaces/IClient.h
src/base/kernel/interfaces/IClientListener.h
@ -73,6 +76,7 @@ set(SOURCES_BASE
src/base/crypto/Coin.cpp
src/base/crypto/keccak.cpp
src/base/crypto/sha3.cpp
src/base/io/Async.cpp
src/base/io/Console.cpp
src/base/io/Env.cpp
src/base/io/json/Json.cpp
@ -119,17 +123,19 @@ if (WIN32)
set(SOURCES_OS
src/base/io/json/Json_win.cpp
src/base/kernel/Platform_win.cpp
src/base/kernel/Process_win.cpp
)
elseif (APPLE)
set(SOURCES_OS
src/base/io/json/Json_unix.cpp
src/base/kernel/Platform_mac.cpp
src/base/kernel/Process_unix.cpp
)
else()
set(SOURCES_OS
src/base/io/Async.cpp
src/base/io/json/Json_unix.cpp
src/base/kernel/Platform_unix.cpp
src/base/kernel/Process_unix.cpp
)
endif()
@ -235,8 +241,15 @@ endif()
if (WITH_RANDOMX AND WITH_BENCHMARK)
add_definitions(/DXMRIG_FEATURE_BENCHMARK)
list(APPEND HEADERS_BASE src/base/net/stratum/NullClient.h)
list(APPEND SOURCES_BASE src/base/net/stratum/NullClient.cpp)
list(APPEND HEADERS_BASE
src/base/net/stratum/benchmark/BenchClient.h
src/base/net/stratum/benchmark/BenchConfig.h
)
list(APPEND SOURCES_BASE
src/base/net/stratum/benchmark/BenchClient.cpp
src/base/net/stratum/benchmark/BenchConfig.cpp
)
else()
remove_definitions(/DXMRIG_FEATURE_BENCHMARK)
endif()

View file

@ -19,9 +19,12 @@
*/
#include "base/io/Async.h"
#include "base/kernel/interfaces/IAsyncListener.h"
#include "base/tools/Handle.h"
#if defined(XMRIG_UV_PERFORMANCE_BUG)
// since 2019.05.16, Version 1.29.0 (Stable) https://github.com/xmrig/xmrig/pull/1889
#if (UV_VERSION_MAJOR >= 1) && (UV_VERSION_MINOR >= 29) && defined(__linux__)
#include <sys/eventfd.h>
#include <sys/poll.h>
#include <unistd.h>
@ -31,16 +34,28 @@
namespace xmrig {
struct uv_async_t: uv_poll_t
{
using uv_async_cb = void (*)(uv_async_t *);
~uv_async_t();
int m_fd = -1;
uv_async_cb m_cb = nullptr;
};
using uv_async_cb = uv_async_t::uv_async_cb;
uv_async_t::~uv_async_t()
{
close(m_fd);
}
static void on_schedule(uv_poll_t *handle, int status, int events)
static void on_schedule(uv_poll_t *handle, int, int)
{
static uint64_t val;
uv_async_t *async = reinterpret_cast<uv_async_t *>(handle);
auto async = reinterpret_cast<uv_async_t *>(handle);
for (;;) {
int r = read(async->m_fd, &val, sizeof(val));
@ -64,7 +79,7 @@ static void on_schedule(uv_poll_t *handle, int status, int events)
}
int uv_async_init(uv_loop_t *loop, uv_async_t *async, uv_async_cb cb)
static int uv_async_init(uv_loop_t *loop, uv_async_t *async, uv_async_cb cb)
{
int fd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
if (fd < 0) {
@ -78,7 +93,7 @@ int uv_async_init(uv_loop_t *loop, uv_async_t *async, uv_async_cb cb)
}
int uv_async_send(uv_async_t *async)
static int uv_async_send(uv_async_t *async)
{
static const uint64_t val = 1;
int r;
@ -96,3 +111,41 @@ int uv_async_send(uv_async_t *async)
} // namespace xmrig
#endif
namespace xmrig {
class AsyncPrivate
{
public:
IAsyncListener *listener = nullptr;
uv_async_t *async = nullptr;
};
} // namespace xmrig
xmrig::Async::Async(IAsyncListener *listener) : d_ptr(new AsyncPrivate())
{
d_ptr->listener = listener;
d_ptr->async = new uv_async_t;
d_ptr->async->data = this;
uv_async_init(uv_default_loop(), d_ptr->async, [](uv_async_t *handle) { static_cast<Async *>(handle->data)->d_ptr->listener->onAsync(); });
}
xmrig::Async::~Async()
{
Handle::close(d_ptr->async);
delete d_ptr;
}
void xmrig::Async::send()
{
uv_async_send(d_ptr->async);
}

View file

@ -22,31 +22,32 @@
#define XMRIG_ASYNC_H
#include <uv.h>
#include "base/tools/Object.h"
// since 2019.05.16, Version 1.29.0 (Stable)
#if (UV_VERSION_MAJOR >= 1) && (UV_VERSION_MINOR >= 29) && defined(__linux__)
#define XMRIG_UV_PERFORMANCE_BUG
namespace xmrig {
struct uv_async_t: uv_poll_t
class AsyncPrivate;
class IAsyncListener;
class Async
{
typedef void (*uv_async_cb)(uv_async_t* handle);
~uv_async_t();
int m_fd = -1;
uv_async_cb m_cb = nullptr;
public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Async)
Async(IAsyncListener *listener);
~Async();
void send();
private:
AsyncPrivate *d_ptr;
};
using uv_async_cb = uv_async_t::uv_async_cb;
extern int uv_async_init(uv_loop_t *loop, uv_async_t *async, uv_async_cb cb);
extern int uv_async_send(uv_async_t *async);
} // namespace xmrig
#endif
#endif /* XMRIG_ASYNC_H */

View file

@ -41,6 +41,7 @@
#include "base/net/tools/NetBuffer.h"
#include "core/config/Config.h"
#include "core/config/ConfigTransform.h"
#include "version.h"
#ifdef HAVE_SYSLOG_H
@ -132,7 +133,16 @@ private:
}
chain.addFile(Process::location(Process::DataLocation, "config.json"));
if (read(chain, config)) {
return config.release();
}
chain.addFile(Process::location(Process::HomeLocation, "." APP_ID ".json"));
if (read(chain, config)) {
return config.release();
}
chain.addFile(Process::location(Process::HomeLocation, ".config" XMRIG_DIR_SEPARATOR APP_ID ".json"));
if (read(chain, config)) {
return config.release();
}

View file

@ -1,12 +1,6 @@
/* 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-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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
@ -29,7 +23,21 @@
#include "base/kernel/Process.h"
#include "3rdparty/fmt/core.h"
#include "base/tools/Chrono.h"
#include "version.h"
#ifdef XMRIG_OS_WIN
# ifdef _MSC_VER
# include <direct.h>
# define MKDIR(path) _mkdir(path.c_str());
# else
# define MKDIR(path) mkdir((path).c_str());
# endif
#else
# define MKDIR(path) mkdir(path.c_str(), 0700);
#endif
namespace xmrig {
@ -73,7 +81,7 @@ static std::string getPath(Process::Location location)
}
const auto path = std::string(pathBuf, size);
const auto pos = path.rfind(Process::kDirSeparator);
const auto pos = path.rfind(*XMRIG_DIR_SEPARATOR);
if (pos != std::string::npos) {
return path.substr(0, pos);
@ -116,15 +124,17 @@ xmrig::Process::Process(int argc, char **argv) :
srand(static_cast<unsigned int>(Chrono::currentMSecsSinceEpoch() ^ reinterpret_cast<uintptr_t>(this)));
setDataDir(m_arguments.value("--data-dir", "-d"));
}
# ifdef XMRIG_SHARED_DATADIR
if (dataDir.empty()) {
dataDir = fmt::format("{}" XMRIG_DIR_SEPARATOR ".xmrig" XMRIG_DIR_SEPARATOR, location(HomeLocation));
MKDIR(dataDir);
int xmrig::Process::pid()
{
# if UV_VERSION_HEX >= 0x011200
return uv_os_getpid();
# else
return 0;
dataDir += APP_KIND;
MKDIR(dataDir);
uv_chdir(dataDir.c_str());
}
# endif
}
@ -154,5 +164,5 @@ xmrig::String xmrig::Process::location(Location location, const char *fileName)
return path.c_str();
}
return (path + kDirSeparator + fileName).c_str();
return fmt::format("{}" XMRIG_DIR_SEPARATOR "{}", path, fileName).c_str();
}

View file

@ -1,12 +1,6 @@
/* 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-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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
@ -29,6 +23,13 @@
#include "base/tools/Arguments.h"
#ifdef WIN32
# define XMRIG_DIR_SEPARATOR "\\"
#else
# define XMRIG_DIR_SEPARATOR "/"
#endif
namespace xmrig {
@ -43,12 +44,6 @@ public:
TempLocation
};
# ifdef WIN32
constexpr const static char kDirSeparator = '\\';
# else
constexpr const static char kDirSeparator = '/';
# endif
Process(int argc, char **argv);
static int pid();

View file

@ -0,0 +1,34 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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 <uv.h>
#include <unistd.h>
#include "base/kernel/Process.h"
int xmrig::Process::pid()
{
# if UV_VERSION_HEX >= 0x011200
return uv_os_getpid();
# else
return getpid();
# endif
}

View file

@ -0,0 +1,33 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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 <uv.h>
#include "base/kernel/Process.h"
int xmrig::Process::pid()
{
# if UV_VERSION_HEX >= 0x011200
return uv_os_getpid();
# else
return GetCurrentProcessId();
# endif
}

View file

@ -153,7 +153,6 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
case IConfig::UrlKey: /* --url */
case IConfig::StressKey: /* --stress */
case IConfig::BenchKey: /* --bench */
{
if (!doc.HasMember(Pools::kPools)) {
doc.AddMember(rapidjson::StringRef(Pools::kPools), rapidjson::kArrayType, doc.GetAllocator());
@ -166,7 +165,7 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
# ifdef XMRIG_FEATURE_BENCHMARK
if (key != IConfig::UrlKey) {
set(doc, array[array.Size() - 1], Pool::kUrl, (key == IConfig::BenchKey) ? "benchmark" :
set(doc, array[array.Size() - 1], Pool::kUrl,
# ifdef XMRIG_FEATURE_TLS
"stratum+ssl://randomx.xmrig.com:443"
# else

View file

@ -0,0 +1,47 @@
/* XMRig
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 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/>.
*/
#ifndef XMRIG_IASYNCLISTENER_H
#define XMRIG_IASYNCLISTENER_H
#include "base/tools/Object.h"
namespace xmrig {
class Async;
class IAsyncListener
{
public:
XMRIG_DISABLE_COPY_MOVE(IAsyncListener)
IAsyncListener() = default;
virtual ~IAsyncListener() = default;
virtual void onAsync() = 0;
};
} /* namespace xmrig */
#endif // XMRIG_IASYNCLISTENER_H

View file

@ -79,6 +79,10 @@ public:
PauseOnBatteryKey = 1041,
StressKey = 1042,
BenchKey = 1043,
BenchSubmitKey = 1044,
BenchVerifyKey = 1045,
BenchSeedKey = 1046,
BenchHashKey = 1047,
// xmrig common
CPUPriorityKey = 1021,

View file

@ -1,6 +1,7 @@
/* XMRig
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2014-2019 heapwolf <https://github.com/heapwolf>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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
@ -18,6 +19,14 @@
#include "base/net/http/HttpData.h"
#include "3rdparty/http-parser/http_parser.h"
#include "3rdparty/rapidjson/document.h"
#include "3rdparty/rapidjson/error/en.h"
#include "base/io/json/Json.h"
#include <uv.h>
#include <stdexcept>
namespace xmrig {
@ -42,3 +51,46 @@ bool xmrig::HttpData::isJSON() const
return type == kApplicationJson || type == kTextPlain;
}
const char *xmrig::HttpData::methodName() const
{
return http_method_str(static_cast<http_method>(method));
}
const char *xmrig::HttpData::statusName() const
{
if (status < 0) {
return uv_strerror(status);
}
return http_status_str(static_cast<http_status>(status));
}
rapidjson::Document xmrig::HttpData::json() const
{
if (status < 0) {
throw std::runtime_error(statusName());
}
if (!isJSON()) {
throw std::runtime_error("the response is not a valid JSON response");
}
using namespace rapidjson;
Document doc;
if (doc.Parse(body.c_str()).HasParseError()) {
throw std::runtime_error(GetParseError_En(doc.GetParseError()));
}
if (doc.IsObject() && !doc.ObjectEmpty()) {
const char *error = Json::getString(doc, "error");
if (error) {
throw std::runtime_error(error);
}
}
return doc;
}

View file

@ -1,13 +1,7 @@
/* 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 2014-2019 heapwolf <https://github.com/heapwolf>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2014-2019 heapwolf <https://github.com/heapwolf>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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
@ -28,6 +22,7 @@
#define XMRIG_HTTPDATA_H
#include "3rdparty/rapidjson/document.h"
#include "base/tools/Object.h"
@ -63,6 +58,9 @@ public:
virtual void write(std::string &&data, bool close) = 0;
bool isJSON() const;
const char *methodName() const;
const char *statusName() const;
rapidjson::Document json() const;
int method = 0;
int status = 0;
@ -70,6 +68,7 @@ public:
std::map<const std::string, const std::string> headers;
std::string body;
std::string url;
uint64_t rpcId = 0;
private:
const uint64_t m_id;

View file

@ -34,6 +34,7 @@
#include "base/kernel/interfaces/IClientListener.h"
#include "base/net/http/Fetch.h"
#include "base/net/http/HttpData.h"
#include "base/net/http/HttpListener.h"
#include "base/net/stratum/SubmitResult.h"
#include "base/tools/Buffer.h"
#include "base/tools/Timer.h"

View file

@ -27,8 +27,8 @@
#define XMRIG_DAEMONCLIENT_H
#include "base/kernel/interfaces/IHttpListener.h"
#include "base/kernel/interfaces/ITimerListener.h"
#include "base/net/http/HttpListener.h"
#include "base/net/stratum/BaseClient.h"
#include "base/tools/Object.h"

View file

@ -174,6 +174,12 @@ void xmrig::Job::copy(const Job &other)
memcpy(m_rawBlob, other.m_rawBlob, sizeof(m_rawBlob));
memcpy(m_rawTarget, other.m_rawTarget, sizeof(m_rawTarget));
# endif
# ifdef XMRIG_FEATURE_BENCHMARK
m_benchSize = other.m_benchSize;
m_benchHash = other.m_benchHash;
m_benchToken = other.m_benchToken;
# endif
}
@ -205,4 +211,10 @@ void xmrig::Job::move(Job &&other)
memcpy(m_rawBlob, other.m_rawBlob, sizeof(m_rawBlob));
memcpy(m_rawTarget, other.m_rawTarget, sizeof(m_rawTarget));
# endif
# ifdef XMRIG_FEATURE_BENCHMARK
m_benchSize = other.m_benchSize;
m_benchHash = other.m_benchHash;
m_benchToken = std::move(other.m_benchToken);
# endif
}

View file

@ -82,7 +82,7 @@ public:
inline uint32_t backend() const { return m_backend; }
inline uint64_t diff() const { return m_diff; }
inline uint64_t height() const { return m_height; }
inline uint64_t nonceMask() const { return isNicehash() ? 0xFFFFFFULL : (nonceSize() == sizeof(uint64_t) ? (-1ull >> (extraNonce().size() * 4)): 0xFFFFFFFFULL); }
inline uint64_t nonceMask() const { return isNicehash() ? 0xFFFFFFULL : (nonceSize() == sizeof(uint64_t) ? (-1ULL >> (extraNonce().size() * 4)): 0xFFFFFFFFULL); }
inline uint64_t target() const { return m_target; }
inline uint8_t *blob() { return m_blob; }
inline uint8_t fixedByte() const { return *(m_blob + 42); }
@ -98,18 +98,27 @@ public:
inline void setPoolWallet(const String &poolWallet) { m_poolWallet = poolWallet; }
# ifdef XMRIG_PROXY_PROJECT
inline char *rawBlob() { return m_rawBlob; }
inline const char *rawBlob() const { return m_rawBlob; }
inline const char *rawTarget() const { return m_rawTarget; }
inline const String &rawSeedHash() const { return m_rawSeedHash; }
inline char *rawBlob() { return m_rawBlob; }
inline const char *rawBlob() const { return m_rawBlob; }
inline const char *rawTarget() const { return m_rawTarget; }
inline const String &rawSeedHash() const { return m_rawSeedHash; }
# endif
static inline uint64_t toDiff(uint64_t target) { return target ? (0xFFFFFFFFFFFFFFFFULL / target) : 0; }
static inline uint64_t toDiff(uint64_t target) { return target ? (0xFFFFFFFFFFFFFFFFULL / target) : 0; }
inline bool operator!=(const Job &other) const { return !isEqual(other); }
inline bool operator==(const Job &other) const { return isEqual(other); }
inline Job &operator=(const Job &other) { copy(other); return *this; }
inline Job &operator=(Job &&other) noexcept { move(std::move(other)); return *this; }
inline bool operator!=(const Job &other) const { return !isEqual(other); }
inline bool operator==(const Job &other) const { return isEqual(other); }
inline Job &operator=(const Job &other) { copy(other); return *this; }
inline Job &operator=(Job &&other) noexcept { move(std::move(other)); return *this; }
# ifdef XMRIG_FEATURE_BENCHMARK
inline const String &benchToken() const { return m_benchToken; }
inline uint32_t benchSize() const { return m_benchSize; }
inline uint64_t benchHash() const { return m_benchHash; }
inline void setBenchHash(uint64_t benchHash) { m_benchHash = benchHash; }
inline void setBenchSize(uint32_t size) { m_benchSize = size; }
inline void setBenchToken(const String &token) { m_benchToken = token; }
# endif
private:
void copy(const Job &other);
@ -135,6 +144,12 @@ private:
char m_rawTarget[24]{};
String m_rawSeedHash;
# endif
# ifdef XMRIG_FEATURE_BENCHMARK
String m_benchToken;
uint32_t m_benchSize = 0;
uint64_t m_benchHash = 0;
# endif
};

View file

@ -1,62 +0,0 @@
/* XMRig
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 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 "base/net/stratum/NullClient.h"
#include "3rdparty/rapidjson/document.h"
#include "base/kernel/interfaces/IClientListener.h"
xmrig::NullClient::NullClient(IClientListener* listener) :
m_listener(listener)
{
m_job.setAlgorithm(Algorithm::RX_0);
std::vector<char> blob(112 * 2 + 1, '0');
blob.back() = '\0';
m_job.setBlob(blob.data());
blob[Job::kMaxSeedSize * 2] = '\0';
m_job.setSeedHash(blob.data());
m_job.setDiff(uint64_t(-1));
m_job.setHeight(1);
m_job.setId("00000000");
}
void xmrig::NullClient::connect()
{
m_listener->onLoginSuccess(this);
rapidjson::Value params;
m_listener->onJobReceived(this, m_job, params);
}
void xmrig::NullClient::setPool(const Pool& pool)
{
m_pool = pool;
if (!m_pool.algorithm().isValid()) {
m_pool.setAlgo(Algorithm::RX_0);
}
m_job.setAlgorithm(m_pool.algorithm().id());
}

View file

@ -51,7 +51,8 @@
#ifdef XMRIG_FEATURE_BENCHMARK
# include "base/net/stratum/NullClient.h"
# include "base/net/stratum/benchmark/BenchClient.h"
# include "base/net/stratum/benchmark/BenchConfig.h"
#endif
@ -84,10 +85,6 @@ const char *Pool::kUrl = "url";
const char *Pool::kUser = "user";
const char *Pool::kNicehashHost = "nicehash.com";
#ifdef XMRIG_FEATURE_BENCHMARK
const char *Pool::kBenchmark = "benchmark";
#endif
}
@ -139,14 +136,6 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
setKeepAlive(Json::getValue(object, kKeepalive));
# ifdef XMRIG_FEATURE_BENCHMARK
if (setBenchSize(Json::getString(object, kBenchmark, nullptr))) {
m_mode = MODE_BENCHMARK;
return;
}
# endif
if (m_daemon.isValid()) {
m_mode = MODE_SELF_SELECT;
}
@ -156,6 +145,31 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
}
#ifdef XMRIG_FEATURE_BENCHMARK
xmrig::Pool::Pool(const std::shared_ptr<BenchConfig> &benchmark) :
m_mode(MODE_BENCHMARK),
m_flags(1 << FLAG_ENABLED),
m_url(BenchConfig::kBenchmark),
m_benchmark(benchmark)
{
}
xmrig::BenchConfig *xmrig::Pool::benchmark() const
{
assert(m_mode == MODE_BENCHMARK && m_benchmark);
return m_benchmark.get();
}
uint32_t xmrig::Pool::benchSize() const
{
return benchmark()->size();
}
#endif
bool xmrig::Pool::isEnabled() const
{
# ifndef XMRIG_FEATURE_TLS
@ -233,7 +247,7 @@ xmrig::IClient *xmrig::Pool::createClient(int id, IClientListener *listener) con
# endif
# ifdef XMRIG_FEATURE_BENCHMARK
else if (m_mode == MODE_BENCHMARK) {
client = new NullClient(listener);
client = new BenchClient(m_benchmark, listener);
}
# endif
@ -337,23 +351,3 @@ void xmrig::Pool::setKeepAlive(const rapidjson::Value &value)
setKeepAlive(value.GetBool());
}
}
#ifdef XMRIG_FEATURE_BENCHMARK
bool xmrig::Pool::setBenchSize(const char *benchmark)
{
if (!benchmark) {
return false;
}
const auto size = strtoul(benchmark, nullptr, 10);
if (size < 1 || size > 10) {
return false;
}
const std::string s = std::to_string(size) + "M";
m_benchSize = strcasecmp(benchmark, s.c_str()) == 0 ? size * 1000000 : 0;
return m_benchSize > 0;
}
#endif

View file

@ -29,6 +29,7 @@
#include <bitset>
#include <vector>
#include <memory>
#include "3rdparty/rapidjson/fwd.h"
@ -39,6 +40,7 @@
namespace xmrig {
class BenchConfig;
class IClient;
class IClientListener;
@ -76,10 +78,6 @@ public:
static const char *kUser;
static const char *kNicehashHost;
# ifdef XMRIG_FEATURE_BENCHMARK
static const char *kBenchmark;
# endif
constexpr static int kKeepAliveTimeout = 60;
constexpr static uint16_t kDefaultPort = 3333;
constexpr static uint64_t kDefaultPollInterval = 1000;
@ -89,6 +87,13 @@ public:
Pool(const char *url);
Pool(const rapidjson::Value &object);
# ifdef XMRIG_FEATURE_BENCHMARK
Pool(const std::shared_ptr<BenchConfig> &benchmark);
BenchConfig *benchmark() const;
uint32_t benchSize() const;
# endif
inline bool isNicehash() const { return m_flags.test(FLAG_NICEHASH); }
inline bool isTLS() const { return m_flags.test(FLAG_TLS) || m_url.isTLS(); }
inline bool isValid() const { return m_url.isValid(); }
@ -112,10 +117,6 @@ public:
inline void setRigId(const String &rigId) { m_rigId = rigId; }
inline void setUser(const String &user) { m_user = user; }
# ifdef XMRIG_FEATURE_BENCHMARK
inline uint32_t benchSize() const { return m_benchSize; }
# endif
inline bool operator!=(const Pool &other) const { return !isEqual(other); }
inline bool operator==(const Pool &other) const { return isEqual(other); }
@ -157,9 +158,7 @@ private:
Url m_url;
# ifdef XMRIG_FEATURE_BENCHMARK
bool setBenchSize(const char *benchmark);
uint32_t m_benchSize = 0;
std::shared_ptr<BenchConfig> m_benchmark;
# endif
};

View file

@ -32,6 +32,11 @@
#include "donate.h"
#ifdef XMRIG_FEATURE_BENCHMARK
# include "base/net/stratum/benchmark/BenchConfig.h"
#endif
namespace xmrig {
@ -118,6 +123,15 @@ void xmrig::Pools::load(const IJsonReader &reader)
{
m_data.clear();
# ifdef XMRIG_FEATURE_BENCHMARK
m_benchmark = std::shared_ptr<BenchConfig>(BenchConfig::create(reader.getObject(BenchConfig::kBenchmark)));
if (m_benchmark) {
m_data.emplace_back(m_benchmark);
return;
}
# endif
const rapidjson::Value &pools = reader.getArray(kPools);
if (!pools.IsArray()) {
return;
@ -147,12 +161,10 @@ void xmrig::Pools::load(const IJsonReader &reader)
uint32_t xmrig::Pools::benchSize() const
{
# ifdef XMRIG_FEATURE_BENCHMARK
if (m_data.size() == 1 && m_data.front().mode() == Pool::MODE_BENCHMARK) {
return m_data.front().benchSize();
}
# endif
return m_benchmark ? m_benchmark->size() : 0;
# else
return 0;
# endif
}

View file

@ -85,6 +85,10 @@ private:
int m_retryPause = 5;
ProxyDonate m_proxyDonate = PROXY_DONATE_AUTO;
std::vector<Pool> m_data;
# ifdef XMRIG_FEATURE_BENCHMARK
std::shared_ptr<BenchConfig> m_benchmark;
# endif
};

View file

@ -0,0 +1,180 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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 "base/net/stratum/benchmark/BenchClient.h"
#include "3rdparty/fmt/core.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/cpu/Cpu.h"
#include "base/io/json/Json.h"
#include "base/io/log/Log.h"
#include "base/io/log/Tags.h"
#include "base/kernel/interfaces/IClientListener.h"
#include "base/net/http/Fetch.h"
#include "base/net/http/HttpData.h"
#include "base/net/http/HttpListener.h"
#include "base/net/stratum/benchmark/BenchConfig.h"
#include "version.h"
xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, IClientListener* listener) :
m_listener(listener),
m_benchmark(benchmark)
{
m_httpListener = std::make_shared<HttpListener>(this, Tags::bench());
std::vector<char> blob(112 * 2 + 1, '0');
blob.back() = '\0';
m_job.setBlob(blob.data());
m_job.setAlgorithm(m_benchmark->algorithm());
m_job.setDiff(std::numeric_limits<uint64_t>::max());
m_job.setHeight(1);
m_job.setBenchSize(m_benchmark->size());
m_job.setBenchHash(m_benchmark->hash());
if (m_benchmark->isSubmit()) {
m_mode = ONLINE_BENCH;
return;
}
if (!m_benchmark->id().isEmpty()) {
m_job.setId(m_benchmark->id());
m_mode = ONLINE_VERIFY;
return;
}
m_job.setId("00000000");
if (m_job.benchHash() && m_job.setSeedHash(m_benchmark->seed())) {
m_mode = STATIC_VERIFY;
return;
}
blob[Job::kMaxSeedSize * 2] = '\0';
m_job.setSeedHash(blob.data());
}
void xmrig::BenchClient::connect()
{
switch (m_mode) {
case STATIC_BENCH:
case STATIC_VERIFY:
return start();
case ONLINE_BENCH:
return createBench();
case ONLINE_VERIFY:
return getBench();
}
}
void xmrig::BenchClient::setPool(const Pool &pool)
{
m_pool = pool;
}
void xmrig::BenchClient::onHttpData(const HttpData &data)
{
rapidjson::Document doc;
try {
doc = data.json();
} catch (const std::exception &ex) {
return setError(ex.what());
}
if (data.status != 200) {
return setError(data.statusName());
}
if (m_mode == ONLINE_BENCH) {
startBench(doc);
}
else {
startVerify(doc);
}
}
void xmrig::BenchClient::createBench()
{
using namespace rapidjson;
Document doc(kObjectType);
auto &allocator = doc.GetAllocator();
doc.AddMember(StringRef(BenchConfig::kSize), m_benchmark->size(), allocator);
doc.AddMember(StringRef(BenchConfig::kAlgo), m_benchmark->algorithm().toJSON(), allocator);
doc.AddMember("version", APP_VERSION, allocator);
doc.AddMember("cpu", Cpu::toJSON(doc), allocator);
FetchRequest req(HTTP_POST, BenchConfig::kApiHost, BenchConfig::kApiPort, "/1/benchmark", doc, BenchConfig::kApiTLS, true);
fetch(std::move(req), m_httpListener);
}
void xmrig::BenchClient::getBench()
{
FetchRequest req(HTTP_GET, BenchConfig::kApiHost, BenchConfig::kApiPort, fmt::format("/1/benchmark/{}", m_job.id()).c_str(), BenchConfig::kApiTLS, true);
fetch(std::move(req), m_httpListener);
}
void xmrig::BenchClient::setError(const char *message)
{
LOG_ERR("%s " RED("benchmark failed ") RED_BOLD("\"%s\""), Tags::bench(), message);
}
void xmrig::BenchClient::start()
{
m_listener->onLoginSuccess(this);
m_listener->onJobReceived(this, m_job, rapidjson::Value());
}
void xmrig::BenchClient::startBench(const rapidjson::Value &value)
{
m_job.setId(Json::getString(value, BenchConfig::kId));
m_job.setSeedHash(Json::getString(value, BenchConfig::kSeed));
m_job.setBenchToken(Json::getString(value, BenchConfig::kToken));
start();
}
void xmrig::BenchClient::startVerify(const rapidjson::Value &value)
{
const char *hash = Json::getString(value, BenchConfig::kHash);
if (hash) {
m_job.setBenchHash(strtoull(hash, nullptr, 16));
}
m_job.setAlgorithm(Json::getString(value, BenchConfig::kAlgo));
m_job.setSeedHash(Json::getString(value, BenchConfig::kSeed));
m_job.setBenchSize(Json::getUint(value, BenchConfig::kSize));
start();
}

View file

@ -1,6 +1,6 @@
/* XMRig
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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
@ -16,26 +16,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_NULLCLIENT_H
#define XMRIG_NULLCLIENT_H
#ifndef XMRIG_BENCHCLIENT_H
#define XMRIG_BENCHCLIENT_H
#include "base/net/stratum/Client.h"
#include "base/kernel/interfaces/IHttpListener.h"
namespace xmrig {
class NullClient : public IClient
class BenchClient : public IClient, public IHttpListener
{
public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(NullClient)
XMRIG_DISABLE_COPY_MOVE_DEFAULT(BenchClient)
NullClient(IClientListener* listener);
~NullClient() override = default;
BenchClient(const std::shared_ptr<BenchConfig> &benchmark, IClientListener* listener);
~BenchClient() override = default;
inline bool disconnect() override { return true; }
inline bool hasExtension(Extension extension) const noexcept override { return false; }
inline bool hasExtension(Extension) const noexcept override { return false; }
inline bool isEnabled() const override { return true; }
inline bool isTLS() const override { return false; }
inline const char *mode() const override { return "benchmark"; }
@ -46,32 +47,52 @@ public:
inline const Pool &pool() const override { return m_pool; }
inline const String &ip() const override { return m_ip; }
inline int id() const override { return 0; }
inline int64_t send(const rapidjson::Value& obj, Callback callback) override { return 0; }
inline int64_t send(const rapidjson::Value& obj) override { return 0; }
inline int64_t send(const rapidjson::Value &, Callback) override { return 0; }
inline int64_t send(const rapidjson::Value &) override { return 0; }
inline int64_t sequence() const override { return 0; }
inline int64_t submit(const JobResult& result) override { return 0; }
inline void connect(const Pool& pool) override { setPool(pool); }
inline int64_t submit(const JobResult &) override { return 0; }
inline void connect(const Pool &pool) override { setPool(pool); }
inline void deleteLater() override {}
inline void setAlgo(const Algorithm& algo) override {}
inline void setAlgo(const Algorithm &algo) override {}
inline void setEnabled(bool enabled) override {}
inline void setProxy(const ProxyUrl& proxy) override {}
inline void setProxy(const ProxyUrl &proxy) override {}
inline void setQuiet(bool quiet) override {}
inline void setRetries(int retries) override {}
inline void setRetryPause(uint64_t ms) override {}
inline void tick(uint64_t now) override {}
void connect() override;
void setPool(const Pool& pool) override;
void setPool(const Pool &pool) override;
protected:
void onHttpData(const HttpData &data) override;
private:
enum Mode : uint32_t {
STATIC_BENCH,
ONLINE_BENCH,
STATIC_VERIFY,
ONLINE_VERIFY
};
void createBench();
void getBench();
void setError(const char *message);
void start();
void startBench(const rapidjson::Value &value);
void startVerify(const rapidjson::Value &value);
IClientListener* m_listener;
Job m_job;
Pool m_pool;
std::shared_ptr<BenchConfig> m_benchmark;
std::shared_ptr<IHttpListener> m_httpListener;
String m_ip;
Mode m_mode = STATIC_BENCH;
};
} /* namespace xmrig */
#endif /* XMRIG_NULLCLIENT_H */
#endif /* XMRIG_BENCHCLIENT_H */

View file

@ -0,0 +1,103 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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 "base/net/stratum/benchmark/BenchConfig.h"
#include "3rdparty/fmt/core.h"
#include "3rdparty/rapidjson/document.h"
#include "base/io/json/Json.h"
#include <string>
#ifdef _MSC_VER
# define strcasecmp _stricmp
#endif
namespace xmrig {
const char *BenchConfig::kAlgo = "algo";
const char *BenchConfig::kBenchmark = "benchmark";
const char *BenchConfig::kHash = "hash";
const char *BenchConfig::kId = "id";
const char *BenchConfig::kSeed = "seed";
const char *BenchConfig::kSize = "size";
const char *BenchConfig::kSubmit = "submit";
const char *BenchConfig::kToken = "token";
const char *BenchConfig::kVerify = "verify";
#ifndef XMRIG_DEBUG_BENCHMARK_API
const char *BenchConfig::kApiHost = "api.xmrig.com";
#else
const char *BenchConfig::kApiHost = "127.0.0.1";
#endif
} // namespace xmrig
xmrig::BenchConfig::BenchConfig(uint32_t size, const String &id, const rapidjson::Value &object) :
m_algorithm(Json::getString(object, kAlgo)),
m_submit(Json::getBool(object, kSubmit)),
m_id(id),
m_seed(Json::getString(object, kSeed)),
m_size(size),
m_hash(0)
{
if (!m_algorithm.isValid() || m_algorithm.family() != Algorithm::RANDOM_X) {
m_algorithm = Algorithm::RX_0;
}
const char *hash = Json::getString(object, kHash);
if (hash) {
m_hash = strtoull(hash, nullptr, 16);
}
}
xmrig::BenchConfig *xmrig::BenchConfig::create(const rapidjson::Value &object)
{
if (!object.IsObject() || object.ObjectEmpty()) {
return nullptr;
}
const uint32_t size = getSize(Json::getString(object, kSize));
const String id = Json::getString(object, kVerify);
if (size == 0 && id.isEmpty()) {
return nullptr;
}
return new BenchConfig(size, id, object);
}
uint32_t xmrig::BenchConfig::getSize(const char *benchmark)
{
if (!benchmark) {
return false;
}
const auto size = strtoul(benchmark, nullptr, 10);
if (size < 1 || size > 10) {
return false;
}
return strcasecmp(benchmark, fmt::format("{}M", size).c_str()) == 0 ? size * 1000000 : 0;
}

View file

@ -0,0 +1,78 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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/>.
*/
#ifndef XMRIG_BENCHCONFIG_H
#define XMRIG_BENCHCONFIG_H
#include "base/crypto/Algorithm.h"
#include "base/tools/String.h"
namespace xmrig {
class BenchConfig
{
public:
static const char *kAlgo;
static const char *kApiHost;
static const char *kBenchmark;
static const char *kHash;
static const char *kId;
static const char *kSeed;
static const char *kSize;
static const char *kSubmit;
static const char *kToken;
static const char *kVerify;
# ifndef XMRIG_DEBUG_BENCHMARK_API
static constexpr bool kApiTLS = true;
static constexpr const uint16_t kApiPort = 443;
# else
static constexpr bool kApiTLS = false;
static constexpr const uint16_t kApiPort = 18805;
# endif
BenchConfig(uint32_t size, const String &id, const rapidjson::Value &object);
static BenchConfig *create(const rapidjson::Value &object);
inline bool isSubmit() const { return m_submit; }
inline const Algorithm &algorithm() const { return m_algorithm; }
inline const String &id() const { return m_id; }
inline const String &seed() const { return m_seed; }
inline uint32_t size() const { return m_size; }
inline uint64_t hash() const { return m_hash; }
private:
static uint32_t getSize(const char *benchmark);
Algorithm m_algorithm;
bool m_submit;
String m_id;
String m_seed;
uint32_t m_size;
uint64_t m_hash;
};
} /* namespace xmrig */
#endif /* XMRIG_BENCHCONFIG_H */

View file

@ -1,12 +1,6 @@
/* 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>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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
@ -34,9 +28,7 @@ xmrig::FailoverStrategy::FailoverStrategy(const std::vector<Pool> &pools, int re
m_quiet(quiet),
m_retries(retries),
m_retryPause(retryPause),
m_active(-1),
m_listener(listener),
m_index(0)
m_listener(listener)
{
for (const Pool &pool : pools) {
add(pool);
@ -48,9 +40,7 @@ xmrig::FailoverStrategy::FailoverStrategy(int retryPause, int retries, IStrategy
m_quiet(quiet),
m_retries(retries),
m_retryPause(retryPause),
m_active(-1),
m_listener(listener),
m_index(0)
m_listener(listener)
{
}

View file

@ -1,12 +1,6 @@
/* 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>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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
@ -78,9 +72,9 @@ private:
const bool m_quiet;
const int m_retries;
const int m_retryPause;
int m_active;
int m_active = -1;
IStrategyListener *m_listener;
size_t m_index;
size_t m_index = 0;
std::vector<IClient*> m_pools;
};

View file

@ -1,6 +1,7 @@
/* XMRig
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2020 cohcho <https://github.com/cohcho>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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

View file

@ -1,6 +1,7 @@
/* XMRig
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2020 cohcho <https://github.com/cohcho>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 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