summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-14 13:02:40 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-14 13:02:40 +0000
commitd4ca01f12f539a7f3eda3a682b5d2fbb67fabdb7 (patch)
tree8a146cf6d517caae1d7798eda21290b4395f38de
parent174169ac35321eedae9df6aabe7833b7df6b0279 (diff)
Add <options:nouserdns> - defaults to off. if set to on, no user dns lookups are performed, saving resources
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4386 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/configreader.h4
-rw-r--r--src/cmd_nick.cpp22
-rw-r--r--src/configreader.cpp3
3 files changed, 20 insertions, 9 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 598fbef81..b37838cf1 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -344,6 +344,10 @@ class ServerConfig : public Extensible
*/
std::map<std::string,int> maxbans;
+ /** If set to true, no user DNS lookups are to be performed
+ */
+ bool NoUserDns;
+
ServerConfig();
/** Clears the include stack in preperation for
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp
index 432c2e814..3eeb37663 100644
--- a/src/cmd_nick.cpp
+++ b/src/cmd_nick.cpp
@@ -143,18 +143,24 @@ void cmd_nick::Handle (char **parameters, int pcnt, userrec *user)
//if (user->dns_done)
// log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
-#ifdef THREADED_DNS
- // initialize their dns lookup thread
- if (pthread_create(&user->dnsthread, NULL, dns_task, (void *)user) != 0)
+ if (Config->NoUserDns)
{
- log(DEBUG,"Failed to create DNS lookup thread for user %s",user->nick);
+ user->dns_done = true;
}
+ else
+ {
+#ifdef THREADED_DNS
+ // initialize their dns lookup thread
+ if (pthread_create(&user->dnsthread, NULL, dns_task, (void *)user) != 0)
+ {
+ log(DEBUG,"Failed to create DNS lookup thread for user %s",user->nick);
+ }
#else
- user->dns_done = (!lookup_dns(user->nick));
- if (user->dns_done)
- log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
+ user->dns_done = (!lookup_dns(user->nick));
+ if (user->dns_done)
+ log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
#endif
-
+ }
}
if (user->registered == 3)
{
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 2cc1cd9c1..04918e7cf 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -45,7 +45,7 @@ ServerConfig::ServerConfig()
*CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0';
*OperOnlyStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0';
log_file = NULL;
- forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = false;
+ NoUserDns = forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = false;
writelog = AllowHalfop = true;
dns_timeout = DieDelay = 5;
MaxTargets = 20;
@@ -545,6 +545,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{"options", "hidewhois", &this->HideWhoisServer, DT_CHARPTR, NoValidation},
{"options", "operspywhois", &this->OperSpyWhois, DT_BOOLEAN, NoValidation},
{"options", "tempdir", &this->TempDir, DT_CHARPTR, ValidateTempDir},
+ {"options", "nouserdns", &this->NoUserDns, DT_BOOLEAN, NoValidation},
{"pid", "file", &this->PID, DT_CHARPTR, NoValidation},
{NULL}
};