diff options
-rw-r--r-- | src/configreader.cpp | 10 | ||||
-rw-r--r-- | src/usermanager.cpp | 5 | ||||
-rw-r--r-- | win/configure.cpp | 11 |
3 files changed, 7 insertions, 19 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 35c65fede..2c5d01ee1 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -47,7 +47,7 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance) dns_timeout = DieDelay = 5; MaxTargets = 20; NetBufferSize = 10240; - SoftLimit = MAXCLIENTS; + SoftLimit = Instance->SE->GetMaxFds(); MaxConn = SOMAXCONN; MaxWhoResults = 0; debugging = 0; @@ -261,10 +261,10 @@ bool ValidateMaxTargets(ServerConfig* conf, const char*, const char*, ValueItem bool ValidateSoftLimit(ServerConfig* conf, const char*, const char*, ValueItem &data) { - if ((data.GetInteger() < 1) || (data.GetInteger() > MAXCLIENTS)) + if ((data.GetInteger() < 1) || (data.GetInteger() > conf->GetInstance()->SE->GetMaxFds())) { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",MAXCLIENTS,MAXCLIENTS); - data.Set(MAXCLIENTS); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",conf->GetInstance()->SE->GetMaxFds(),conf->GetInstance()->SE->GetMaxFds()); + data.Set(conf->GetInstance()->SE->GetMaxFds()); } return true; } @@ -767,7 +767,7 @@ void ServerConfig::Read(bool bail, User* user) /* These tags can occur ONCE or not at all */ InitialConfig Values[] = { - {"options", "softlimit", MAXCLIENTS_S, new ValueContainerUInt (&this->SoftLimit), DT_INTEGER, ValidateSoftLimit}, + {"options", "softlimit", "0", new ValueContainerUInt (&this->SoftLimit), DT_INTEGER, ValidateSoftLimit}, {"options", "somaxconn", SOMAXCONN_S, new ValueContainerInt (&this->MaxConn), DT_INTEGER, ValidateMaxConn}, {"options", "moronbanner", "Youre banned!", new ValueContainerChar (this->MoronBanner), DT_CHARPTR, NoValidation}, {"server", "name", "", new ValueContainerChar (this->ServerName), DT_HOSTNAME|DT_BOOTONLY, ValidateServerName}, diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 6a23ad795..59ac3fce9 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -108,7 +108,7 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac this->local_users.push_back(New); - if ((this->local_users.size() > Instance->Config->SoftLimit) || (this->local_users.size() >= MAXCLIENTS)) + if ((this->local_users.size() > Instance->Config->SoftLimit) || (this->local_users.size() >= Instance->SE->GetMaxFds())) { Instance->SNO->WriteToSnoMask('A', "Warning: softlimit value has been reached: %d clients", Instance->Config->SoftLimit); User::QuitUser(Instance, New,"No more connections allowed"); @@ -125,13 +125,12 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac * which for the time being is a physical impossibility (even the largest networks dont have more * than about 10,000 users on ONE server!) */ -#ifndef WINDOWS if (socket >= Instance->SE->GetMaxFds()) { User::QuitUser(Instance, New, "Server is full"); return; } -#endif + /* * even with bancache, we still have to keep User::exempt current. * besides that, if we get a positive bancache hit, we still won't fuck diff --git a/win/configure.cpp b/win/configure.cpp index 647295965..e44312724 100644 --- a/win/configure.cpp +++ b/win/configure.cpp @@ -184,7 +184,6 @@ void Banner() void Run() { - int max_fd = 10200; bool use_iocp = false; bool support_ip6links = true; bool use_openssl = false; @@ -198,7 +197,6 @@ void Run() char openssl_inc_path[MAX_PATH]; char openssl_lib_path[MAX_PATH]; - int max_clients = 10200; int nicklen = 31; int chanlen = 64; int modechanges = 20; @@ -237,8 +235,6 @@ void Run() #endif printf_c("InspIRCd revision ID: \033[1;32m%s \033[0m\n\n", revision ? revision_text : "(Non-SVN build)"); - max_fd = get_int_option("What is the maximum file descriptor count you would like to allow?", 10200); - // detect windows if(iswinxp()) { @@ -271,8 +267,6 @@ void Run() "of the 'maximum number of clients' setting which may be different on\n" "different servers on the network.\n\n"); - - max_clients = get_int_option("Please enter the maximum number of clients at any one time?", 10200); nicklen = get_int_option("Please enter the maximum length of nicknames?", 31); chanlen = get_int_option("Please enter the maximum length of channel names?", 64); modechanges = get_int_option("Please enter the maximum number of mode changes in one line?", 20); @@ -336,8 +330,6 @@ void Run() printf_c("\033[0mModule path:\033[1;32m %s\n", mod_path); printf_c("\033[0mLibrary path:\033[1;32m %s\n", library_dir); printf_c("\033[0mSocket Engine:\033[1;32m %s\n", use_iocp ? "iocp" : "select"); - printf_c("\033[0mMax file descriptors:\033[1;32m %u\n", max_fd); - printf_c("\033[0mMax connections:\033[1;32m %u\n", max_clients); printf_c("\033[0mMax nickname length:\033[1;32m %u\n", nicklen); printf_c("\033[0mMax channel length:\033[1;32m %u\n", chanlen); printf_c("\033[0mMax mode length:\033[1;32m %u\n", modechanges); @@ -372,9 +364,6 @@ void Run() fprintf(f, "#define CONFIG_FILE \"%s/inspircd.conf\"\n", config_file); fprintf(f, "#define MOD_PATH \"%s\"\n", mod_path); - fprintf(f, "#define MAX_DESCRIPTORS %u\n", max_fd); - fprintf(f, "#define MAXCLIENTS %u\n", max_clients); - fprintf(f, "#define MAXCLIENTS_S \"%u\"\n", max_clients); fprintf(f, "#define SOMAXCONN_S \"128\"\n"); fprintf(f, "#define NICKMAX %u\n", nicklen+1); fprintf(f, "#define CHANMAX %u\n", chanlen+1); |