summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-26 05:58:09 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-26 05:58:09 +0000
commit0ed148acc39618853e0ef62086379be9459e2b58 (patch)
tree4b4db17b878b460f80ceaec84f2dd4c5890ca83d /src
parent79c0364d54e9f0494c2e8da855cf09193e2d4704 (diff)
Add some defaults to serverconfig, removing need to set them in validate methods. Still more to do in multitags.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6120 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/configreader.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 7741b9d9f..0ee9c767f 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -223,15 +223,6 @@ bool ValidateMaxConn(ServerConfig* conf, const char* tag, const char* value, Val
{
if (data.GetInteger() > SOMAXCONN)
conf->GetInstance()->Log(DEFAULT,"WARNING: <options:somaxconn> value may be higher than the system-defined SOMAXCONN value!");
- if (!data.GetInteger())
- data.Set(SOMAXCONN);
- return true;
-}
-
-bool ValidateDnsTimeout(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
-{
- if (!data.GetInteger())
- data.Set(5);
return true;
}
@@ -585,8 +576,10 @@ void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail,
void ServerConfig::Read(bool bail, userrec* user)
{
- static char debug[MAXBUF]; /* Temporary buffer for debugging value */
+ static char debug[MAXBUF]; /* Temporary buffer for debugging value */
static char maxkeep[MAXBUF]; /* Temporary buffer for WhoWasMaxKeep value */
+ static char softlimit[MAXBUF]; /* Temporary buffer for softlimit default */
+ static char somax[MAXBUF]; /* Temporary buffer for somax default */
int rem = 0, add = 0; /* Number of modules added, number of modules removed */
std::ostringstream errstr; /* String stream containing the error output */
@@ -595,8 +588,8 @@ void ServerConfig::Read(bool bail, userrec* user)
/* These tags can occur ONCE or not at all */
InitialConfig Values[] = {
- {"options", "softlimit", "", new ValueContainerUInt (&this->SoftLimit), DT_INTEGER, ValidateSoftLimit},
- {"options", "somaxconn", "", new ValueContainerInt (&this->MaxConn), DT_INTEGER, ValidateMaxConn},
+ {"options", "softlimit", itoa(MAXCLIENTS, softlimit, 10), new ValueContainerUInt (&this->SoftLimit), DT_INTEGER, ValidateSoftLimit},
+ {"options", "somaxconn", itoa(SOMAXCONN, somax, 10), new ValueContainerInt (&this->MaxConn), DT_INTEGER, ValidateMaxConn},
{"server", "name", "", new ValueContainerChar (this->ServerName), DT_CHARPTR, ValidateServerName},
{"server", "description", "", new ValueContainerChar (this->ServerDesc), DT_CHARPTR, NoValidation},
{"server", "network", "", new ValueContainerChar (this->Network), DT_CHARPTR, NoValidation},
@@ -610,11 +603,11 @@ void ServerConfig::Read(bool bail, userrec* user)
{"power", "restartpass", "", new ValueContainerChar (this->restartpass), DT_CHARPTR, NoValidation},
{"options", "prefixquit", "", new ValueContainerChar (this->PrefixQuit), DT_CHARPTR, NoValidation},
{"options", "loglevel", "", new ValueContainerChar (debug), DT_CHARPTR, ValidateLogLevel},
- {"options", "netbuffersize","", new ValueContainerInt (&this->NetBufferSize), DT_INTEGER, ValidateNetBufferSize},
- {"options", "maxwho", "", new ValueContainerInt (&this->MaxWhoResults), DT_INTEGER, ValidateMaxWho},
+ {"options", "netbuffersize","10240", new ValueContainerInt (&this->NetBufferSize), DT_INTEGER, ValidateNetBufferSize},
+ {"options", "maxwho", "128", new ValueContainerInt (&this->MaxWhoResults), DT_INTEGER, ValidateMaxWho},
{"options", "allowhalfop", "", new ValueContainerBool (&this->AllowHalfop), DT_BOOLEAN, NoValidation},
{"dns", "server", "", new ValueContainerChar (this->DNSServer), DT_CHARPTR, ValidateDnsServer},
- {"dns", "timeout", "", new ValueContainerInt (&this->dns_timeout), DT_INTEGER, ValidateDnsTimeout},
+ {"dns", "timeout", "5", new ValueContainerInt (&this->dns_timeout), DT_INTEGER, NoValidation},
{"options", "moduledir", "", new ValueContainerChar (this->ModPath), DT_CHARPTR, ValidateModPath},
{"disabled", "commands", "", new ValueContainerChar (this->DisabledCommands), DT_CHARPTR, NoValidation},
{"options", "userstats", "", new ValueContainerChar (this->UserStats), DT_CHARPTR, NoValidation},
@@ -1314,13 +1307,19 @@ bool ServerConfig::ConfValue(ConfigDataHash &target, const std::string &tag, con
}
}
}
+ if (!default_value.empty())
+ {
+ result = default_value;
+ ServerInstance->Log(DEBUG, "No config option for '%s' in tag <%s> using default: %s", var.c_str(), tag.c_str(), default_value.c_str());
+ return true;
+ }
}
else if(pos == 0)
{
if (!default_value.empty())
{
result = default_value;
- ServerInstance->Log(DEBUG, "No <%s> tags in config file using default.", tag.c_str());
+ ServerInstance->Log(DEBUG, "No <%s:%s> tags in config file using default: %s", tag.c_str(), var.c_str(), default_value.c_str());
return true;
}
ServerInstance->Log(DEBUG, "No <%s> tags in config file.", tag.c_str());
@@ -1329,7 +1328,6 @@ bool ServerConfig::ConfValue(ConfigDataHash &target, const std::string &tag, con
{
ServerInstance->Log(DEBUG, "ConfValue got an out-of-range index %d, there are only %d occurences of %s", pos, target.count(tag), tag.c_str());
}
-
return false;
}