Added "enabled" field to pools.

This commit is contained in:
XMRig 2019-02-17 15:55:05 +07:00
parent bdff4064a2
commit 7c789a0d3c
2 changed files with 14 additions and 6 deletions

View file

@ -45,18 +45,20 @@
#endif #endif
static const char *kEnabled = "enabled";
static const char *kFingerprint = "tls-fingerprint";
static const char *kKeepalive = "keepalive";
static const char *kNicehash = "nicehash";
static const char *kPass = "pass";
static const char *kRigId = "rig-id";
static const char *kTls = "tls"; static const char *kTls = "tls";
static const char *kUrl = "url"; static const char *kUrl = "url";
static const char *kUser = "user"; static const char *kUser = "user";
static const char *kPass = "pass";
static const char *kRigId = "rig-id";
static const char *kNicehash = "nicehash";
static const char *kKeepalive = "keepalive";
static const char *kVariant = "variant"; static const char *kVariant = "variant";
static const char *kFingerprint = "tls-fingerprint";
xmrig::Pool::Pool() : xmrig::Pool::Pool() :
m_enabled(true),
m_nicehash(false), m_nicehash(false),
m_tls(false), m_tls(false),
m_keepAlive(0), m_keepAlive(0),
@ -77,6 +79,7 @@ xmrig::Pool::Pool() :
* @param url * @param url
*/ */
xmrig::Pool::Pool(const char *url) : xmrig::Pool::Pool(const char *url) :
m_enabled(true),
m_nicehash(false), m_nicehash(false),
m_tls(false), m_tls(false),
m_keepAlive(0), m_keepAlive(0),
@ -87,6 +90,7 @@ xmrig::Pool::Pool(const char *url) :
xmrig::Pool::Pool(const rapidjson::Value &object) : xmrig::Pool::Pool(const rapidjson::Value &object) :
m_enabled(true),
m_nicehash(false), m_nicehash(false),
m_tls(false), m_tls(false),
m_keepAlive(0), m_keepAlive(0),
@ -117,6 +121,7 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
algorithm().parseVariant(variant.GetInt()); algorithm().parseVariant(variant.GetInt());
} }
m_enabled = Json::getBool(object, kEnabled, true);
m_tls = Json::getBool(object, kTls); m_tls = Json::getBool(object, kTls);
m_fingerprint = Json::getString(object, kFingerprint); m_fingerprint = Json::getString(object, kFingerprint);
} }
@ -171,13 +176,14 @@ bool xmrig::Pool::isEnabled() const
} }
# endif # endif
return isValid() && algorithm().isValid(); return m_enabled && isValid() && algorithm().isValid();
} }
bool xmrig::Pool::isEqual(const Pool &other) const bool xmrig::Pool::isEqual(const Pool &other) const
{ {
return (m_nicehash == other.m_nicehash return (m_nicehash == other.m_nicehash
&& m_enabled == other.m_enabled
&& m_tls == other.m_tls && m_tls == other.m_tls
&& m_keepAlive == other.m_keepAlive && m_keepAlive == other.m_keepAlive
&& m_port == other.m_port && m_port == other.m_port
@ -295,6 +301,7 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
break; break;
} }
obj.AddMember(StringRef(kEnabled), m_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);

View file

@ -104,6 +104,7 @@ private:
Algorithm m_algorithm; Algorithm m_algorithm;
Algorithms m_algorithms; Algorithms m_algorithms;
bool m_enabled;
bool m_nicehash; bool m_nicehash;
bool m_tls; bool m_tls;
int m_keepAlive; int m_keepAlive;