New config subsystem
This commit is contained in:
parent
85ee55f309
commit
fa2a0b9b79
37 changed files with 1628 additions and 1254 deletions
|
@ -44,16 +44,6 @@ xmrig::Pools::Pools() :
|
|||
}
|
||||
|
||||
|
||||
xmrig::Pool &xmrig::Pools::current()
|
||||
{
|
||||
if (m_data.empty()) {
|
||||
m_data.push_back(Pool());
|
||||
}
|
||||
|
||||
return m_data.back();
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Pools::isEqual(const Pools &other) const
|
||||
{
|
||||
if (m_data.size() != other.m_data.size() || m_retries != other.m_retries || m_retryPause != other.m_retryPause) {
|
||||
|
@ -64,25 +54,6 @@ bool xmrig::Pools::isEqual(const Pools &other) const
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::Pools::setUrl(const char *url)
|
||||
{
|
||||
if (m_data.empty() || m_data.back().isValid()) {
|
||||
Pool pool(url);
|
||||
|
||||
if (pool.isValid()) {
|
||||
m_data.push_back(std::move(pool));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
current().parse(url);
|
||||
|
||||
return m_data.back().isValid();
|
||||
}
|
||||
|
||||
|
||||
xmrig::IStrategy *xmrig::Pools::createStrategy(IStrategyListener *listener) const
|
||||
{
|
||||
if (active() == 1) {
|
||||
|
@ -144,6 +115,10 @@ void xmrig::Pools::load(const rapidjson::Value &pools)
|
|||
{
|
||||
m_data.clear();
|
||||
|
||||
if (!pools.IsArray()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const rapidjson::Value &value : pools.GetArray()) {
|
||||
if (!value.IsObject()) {
|
||||
continue;
|
||||
|
|
|
@ -50,28 +50,16 @@ public:
|
|||
|
||||
Pools();
|
||||
|
||||
inline bool setUserpass(const char *userpass) { return current().setUserpass(userpass); }
|
||||
inline const std::vector<Pool> &data() const { return m_data; }
|
||||
inline int donateLevel() const { return m_donateLevel; }
|
||||
inline int retries() const { return m_retries; }
|
||||
inline int retryPause() const { return m_retryPause; }
|
||||
inline ProxyDonate proxyDonate() const { return m_proxyDonate; }
|
||||
inline void setFingerprint(const char *fingerprint) { current().setFingerprint(fingerprint); }
|
||||
inline void setKeepAlive(bool enable) { current().setKeepAlive(enable); }
|
||||
inline void setKeepAlive(int keepAlive) { current().setKeepAlive(keepAlive); }
|
||||
inline void setNicehash(bool enable) { current().setNicehash(enable); }
|
||||
inline void setPassword(const char *password) { current().setPassword(password); }
|
||||
inline void setRigId(const char *rigId) { current().setRigId(rigId); }
|
||||
inline void setTLS(bool enable) { current().setTLS(enable); }
|
||||
inline void setUser(const char *user) { current().setUser(user); }
|
||||
inline void setVariant(const char *variant) { current().algorithm().parseVariant(variant); }
|
||||
inline void setVariant(int variant) { current().algorithm().parseVariant(variant); }
|
||||
|
||||
inline bool operator!=(const Pools &other) const { return !isEqual(other); }
|
||||
inline bool operator==(const Pools &other) const { return isEqual(other); }
|
||||
|
||||
bool isEqual(const Pools &other) const;
|
||||
bool setUrl(const char *url);
|
||||
IStrategy *createStrategy(IStrategyListener *listener) const;
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
size_t active() const;
|
||||
|
@ -84,8 +72,6 @@ public:
|
|||
void setRetryPause(int retryPause);
|
||||
|
||||
private:
|
||||
Pool ¤t();
|
||||
|
||||
int m_donateLevel;
|
||||
int m_retries;
|
||||
int m_retryPause;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue