mirror of
https://github.com/xmrig/xmrig.git
synced 2025-03-23 23:58:53 +00:00
Allow null algorithm for pools.
This commit is contained in:
parent
b73c204e73
commit
6990324681
5 changed files with 56 additions and 32 deletions
|
@ -421,28 +421,28 @@ bool xmrig::Client::send(BIO *bio)
|
||||||
|
|
||||||
bool xmrig::Client::verifyAlgorithm(const Algorithm &algorithm) const
|
bool xmrig::Client::verifyAlgorithm(const Algorithm &algorithm) const
|
||||||
{
|
{
|
||||||
# ifdef XMRIG_PROXY_PROJECT
|
//# ifdef XMRIG_PROXY_PROJECT
|
||||||
if (m_pool.algorithm().variant() == VARIANT_AUTO || m_id == -1) {
|
// if (m_pool.algorithm().variant() == VARIANT_AUTO || m_id == -1) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
# endif
|
//# endif
|
||||||
|
|
||||||
if (m_pool.algorithm() == algorithm) { // FIXME
|
// if (m_pool.algorithm() == algorithm) { // FIXME
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (isQuiet()) {
|
// if (isQuiet()) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (algorithm.isValid()) {
|
// if (algorithm.isValid()) {
|
||||||
LOG_ERR("Incompatible algorithm \"%s\" detected, reconnect", algorithm.name());
|
// LOG_ERR("Incompatible algorithm \"%s\" detected, reconnect", algorithm.name());
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
LOG_ERR("Unknown/unsupported algorithm detected, reconnect");
|
// LOG_ERR("Unknown/unsupported algorithm detected, reconnect");
|
||||||
}
|
// }
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,11 @@ bool xmrig::Pool::isEnabled() const
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
return m_flags.test(FLAG_ENABLED) && isValid() && algorithm().isValid();
|
if (isDaemon() && !algorithm().isValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_flags.test(FLAG_ENABLED) && isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,28 +263,34 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
||||||
|
|
||||||
Value obj(kObjectType);
|
Value obj(kObjectType);
|
||||||
|
|
||||||
obj.AddMember(StringRef(kAlgo), StringRef(m_algorithm.shortName()), allocator);
|
obj.AddMember(StringRef(kAlgo), m_algorithm.toJSON(), allocator);
|
||||||
obj.AddMember(StringRef(kUrl), m_url.toJSON(), allocator);
|
obj.AddMember(StringRef(kUrl), m_url.toJSON(), allocator);
|
||||||
obj.AddMember(StringRef(kUser), m_user.toJSON(), allocator);
|
obj.AddMember(StringRef(kUser), m_user.toJSON(), allocator);
|
||||||
obj.AddMember(StringRef(kPass), m_password.toJSON(), allocator);
|
|
||||||
obj.AddMember(StringRef(kRigId), m_rigId.toJSON(), allocator);
|
|
||||||
|
|
||||||
# ifndef XMRIG_PROXY_PROJECT
|
if (!isDaemon()) {
|
||||||
obj.AddMember(StringRef(kNicehash), isNicehash(), allocator);
|
obj.AddMember(StringRef(kPass), m_password.toJSON(), allocator);
|
||||||
# endif
|
obj.AddMember(StringRef(kRigId), m_rigId.toJSON(), allocator);
|
||||||
|
|
||||||
if (m_keepAlive == 0 || m_keepAlive == kKeepAliveTimeout) {
|
# ifndef XMRIG_PROXY_PROJECT
|
||||||
obj.AddMember(StringRef(kKeepalive), m_keepAlive > 0, allocator);
|
obj.AddMember(StringRef(kNicehash), isNicehash(), allocator);
|
||||||
}
|
# endif
|
||||||
else {
|
|
||||||
obj.AddMember(StringRef(kKeepalive), m_keepAlive, allocator);
|
if (m_keepAlive == 0 || m_keepAlive == kKeepAliveTimeout) {
|
||||||
|
obj.AddMember(StringRef(kKeepalive), m_keepAlive > 0, allocator);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
obj.AddMember(StringRef(kKeepalive), m_keepAlive, allocator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.AddMember(StringRef(kEnabled), m_flags.test(FLAG_ENABLED), allocator);
|
obj.AddMember(StringRef(kEnabled), m_flags.test(FLAG_ENABLED), allocator);
|
||||||
obj.AddMember(StringRef(kTls), isTLS(), allocator);
|
obj.AddMember(StringRef(kTls), isTLS(), allocator);
|
||||||
obj.AddMember(StringRef(kFingerprint), m_fingerprint.toJSON(), allocator);
|
obj.AddMember(StringRef(kFingerprint), m_fingerprint.toJSON(), allocator);
|
||||||
obj.AddMember(StringRef(kDaemon), m_flags.test(FLAG_DAEMON), allocator);
|
obj.AddMember(StringRef(kDaemon), m_flags.test(FLAG_DAEMON), allocator);
|
||||||
obj.AddMember(StringRef(kDaemonPollInterval), m_pollInterval, allocator);
|
|
||||||
|
if (isDaemon()) {
|
||||||
|
obj.AddMember(StringRef(kDaemonPollInterval), m_pollInterval, allocator);
|
||||||
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ void xmrig::Pools::print() const
|
||||||
i,
|
i,
|
||||||
(pool.isEnabled() ? (pool.isTLS() ? 32 : 36) : 31),
|
(pool.isEnabled() ? (pool.isTLS() ? 32 : 36) : 31),
|
||||||
pool.url().data(),
|
pool.url().data(),
|
||||||
pool.algorithm().shortName()
|
pool.algorithm().isValid() ? pool.algorithm().shortName() : "auto"
|
||||||
);
|
);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "crypto/common/Algorithm.h"
|
#include "crypto/common/Algorithm.h"
|
||||||
|
#include "rapidjson/document.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -111,6 +112,14 @@ static AlgoName const algorithm_names[] = {
|
||||||
} /* namespace xmrig */
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
rapidjson::Value xmrig::Algorithm::toJSON() const
|
||||||
|
{
|
||||||
|
using namespace rapidjson;
|
||||||
|
|
||||||
|
return isValid() ? Value(StringRef(shortName())) : Value(kNullType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
|
xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
#include "rapidjson/fwd.h"
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,6 +94,8 @@ public:
|
||||||
inline bool operator==(const Algorithm &other) const { return isEqual(other); }
|
inline bool operator==(const Algorithm &other) const { return isEqual(other); }
|
||||||
inline operator Algorithm::Id() const { return m_id; }
|
inline operator Algorithm::Id() const { return m_id; }
|
||||||
|
|
||||||
|
rapidjson::Value toJSON() const;
|
||||||
|
|
||||||
static Family family(Id id);
|
static Family family(Id id);
|
||||||
static Id parse(const char *name);
|
static Id parse(const char *name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue