Further httpd integration

This commit is contained in:
fireice-uk
2017-01-16 00:59:05 +00:00
parent 2033ed3628
commit 9c9df104bd
7 changed files with 48 additions and 9 deletions
+15 -2
View File
@@ -34,8 +34,8 @@ using namespace rapidjson;
/*
* This enum needs to match index in oConfigValues, otherwise we will get a runtime error
*/
enum configEnum { iCpuThreadNum, aCpuThreadsConf, sUseSlowMem, sPoolAddr,
sWalletAddr, sPoolPwd, iCallTimeout, iNetRetry, iVerboseLevel, iAutohashTime, bPreferIpv4 };
enum configEnum { iCpuThreadNum, aCpuThreadsConf, sUseSlowMem, sPoolAddr, sWalletAddr,
sPoolPwd, iCallTimeout, iNetRetry, iVerboseLevel, iAutohashTime, iHttpdPort, bPreferIpv4 };
struct configVal {
configEnum iName;
@@ -55,6 +55,7 @@ configVal oConfigValues[] = {
{ iNetRetry, "retry_time", kNumberType },
{ iVerboseLevel, "verbose_level", kNumberType },
{ iAutohashTime, "h_print_time", kNumberType },
{ iHttpdPort, "httpd_port", kNumberType },
{ bPreferIpv4, "prefer_ipv4", kTrueType }
};
@@ -185,6 +186,11 @@ uint64_t jconf::GetAutohashTime()
return prv->configValues[iAutohashTime]->GetUint64();
}
uint16_t jconf::GetHttpdPort()
{
return prv->configValues[iHttpdPort]->GetUint();
}
bool jconf::parse_config(const char* sFilename)
{
FILE * pFile;
@@ -317,6 +323,13 @@ bool jconf::parse_config(const char* sFilename)
return false;
}
if(!prv->configValues[iHttpdPort]->IsUint() || prv->configValues[iHttpdPort]->GetUint() > 0xFFFF)
{
printer::inst()->print_msg(L0,
"Invalid config file. httpd_port has to be in the range 0 to 65535.");
return false;
}
#ifdef _WIN32
if(GetSlowMemSetting() == no_mlck)
{