Sync changes with proxy.

This commit is contained in:
XMRig 2018-04-25 14:48:32 +07:00
parent b9fec2fcc4
commit ca149d2eed
22 changed files with 436 additions and 328 deletions

View file

@ -38,7 +38,6 @@
xmrig::CommonConfig::CommonConfig() :
m_algorithm(CRYPTONIGHT),
m_adjusted(false),
m_apiIPv6(false),
m_apiRestricted(true),
@ -80,8 +79,12 @@ bool xmrig::CommonConfig::adjust()
m_adjusted = true;
if (!m_algorithm.isValid()) {
m_algorithm.setAlgo(CRYPTONIGHT);
}
for (Pool &pool : m_pools) {
pool.adjust(algorithm());
pool.adjust(m_algorithm.algo());
}
return true;
@ -90,7 +93,7 @@ bool xmrig::CommonConfig::adjust()
bool xmrig::CommonConfig::isValid() const
{
return m_pools[0].isValid() && m_algorithm != INVALID_ALGO;
return m_pools[0].isValid() && m_algorithm.isValid();
}
@ -141,7 +144,7 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg)
{
switch (key) {
case AlgorithmKey: /* --algo */
m_algorithm = Pool::algorithm(arg);
m_algorithm.parseAlgorithm(arg);
break;
case UserpassKey: /* --userpass */
@ -181,6 +184,10 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg)
m_pools.back().setRigId(arg);
break;
case VariantKey: /* --variant */
m_pools.back().algorithm().parseVariant(arg);
break;
case LogFileKey: /* --log-file */
m_logFile = arg;
break;
@ -199,7 +206,6 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg)
case RetriesKey: /* --retries */
case RetryPauseKey: /* --retry-pause */
case VariantKey: /* --variant */
case ApiPort: /* --api-port */
case PrintTimeKey: /* --cpu-priority */
return parseUint64(key, strtol(arg, nullptr, 10));
@ -299,7 +305,7 @@ bool xmrig::CommonConfig::parseInt(int key, int arg)
break;
case VariantKey: /* --variant */
m_pools.back().setVariant(arg);
m_pools.back().algorithm().parseVariant(arg);
break;
case DonateLevelKey: /* --donate-level */

View file

@ -43,13 +43,12 @@ public:
CommonConfig();
~CommonConfig();
inline Algo algorithm() const { return m_algorithm; }
inline bool isApiIPv6() const { return m_apiIPv6; }
inline bool isApiRestricted() const { return m_apiRestricted; }
inline bool isBackground() const { return m_background; }
inline bool isColors() const { return m_colors; }
inline bool isSyslog() const { return m_syslog; }
inline const char *algoName() const { return Pool::algoName(m_algorithm); }
inline const Algorithm &algorithm() const { return m_algorithm; }
inline const char *apiToken() const { return m_apiToken.data(); }
inline const char *apiWorkerId() const { return m_apiWorkerId.data(); }
inline const char *logFile() const { return m_logFile.data(); }
@ -74,7 +73,7 @@ protected:
bool save() override;
void setFileName(const char *fileName) override;
Algo m_algorithm;
Algorithm m_algorithm;
bool m_adjusted;
bool m_apiIPv6;
bool m_apiRestricted;