Giveup limit

This commit is contained in:
fireice-uk
2017-02-12 14:14:27 +00:00
parent 433db1917e
commit 1b4f0dd57b
5 changed files with 31 additions and 4 deletions
+12 -3
View File
@@ -38,7 +38,8 @@ using namespace rapidjson;
* This enum needs to match index in oConfigValues, otherwise we will get a runtime error
*/
enum configEnum { iCpuThreadNum, aCpuThreadsConf, sUseSlowMem, bNiceHashMode, bTlsMode, bTlsSecureAlgo, sTlsFingerprint,
sPoolAddr, sWalletAddr, sPoolPwd, iCallTimeout, iNetRetry, iVerboseLevel, iAutohashTime, iHttpdPort, bPreferIpv4 };
sPoolAddr, sWalletAddr, sPoolPwd, iCallTimeout, iNetRetry, iGiveUpLimit, iVerboseLevel, iAutohashTime, iHttpdPort,
bPreferIpv4 };
struct configVal {
configEnum iName;
@@ -60,6 +61,7 @@ configVal oConfigValues[] = {
{ sPoolPwd, "pool_password", kStringType },
{ iCallTimeout, "call_timeout", kNumberType },
{ iNetRetry, "retry_time", kNumberType },
{ iGiveUpLimit, "giveup_limit", kNumberType },
{ iVerboseLevel, "verbose_level", kNumberType },
{ iAutohashTime, "h_print_time", kNumberType },
{ iHttpdPort, "httpd_port", kNumberType },
@@ -207,6 +209,11 @@ uint64_t jconf::GetNetRetry()
return prv->configValues[iNetRetry]->GetUint64();
}
uint64_t jconf::GetGiveUpLimit()
{
return prv->configValues[iGiveUpLimit]->GetUint64();
}
uint64_t jconf::GetVerboseLevel()
{
return prv->configValues[iVerboseLevel]->GetUint64();
@@ -378,10 +385,12 @@ bool jconf::parse_config(const char* sFilename)
return false;
}
if(!prv->configValues[iCallTimeout]->IsUint64() || !prv->configValues[iNetRetry]->IsUint64())
if(!prv->configValues[iCallTimeout]->IsUint64() ||
!prv->configValues[iNetRetry]->IsUint64() ||
!prv->configValues[iGiveUpLimit]->IsUint64())
{
printer::inst()->print_msg(L0,
"Invalid config file. call_timeout and retry_time need to be positive integers.");
"Invalid config file. call_timeout, retry_time and giveup_limit need to be positive integers.");
return false;
}