summaryrefslogtreecommitdiff
path: root/src/dns.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-04-06 02:25:20 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-04-06 02:25:20 +0000
commita7b0c26a4c56440e4bc5ddc6d3ecfeb36089dbb2 (patch)
treeba6da52898a7ce1e157bef549647664c5258fe48 /src/dns.cpp
parentec48546cd05136c61f85d669a3dc49a874935a89 (diff)
Holy christ that was a LOT OF SPACES. TABS, USE THEM, LOVE THEM, APPRECIATE THEM - we now have no stupid spaces. This was mostly a mass find/replace, so some indentation may be stuffed. Minor issue, though.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3838 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index dc25fe8fe..bdb7889a5 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -210,12 +210,12 @@ void DNS::dns_init()
void DNS::dns_init_2(const char* dnsserver)
{
- in_addr addr4;
- i4 = 0;
- srand((unsigned int) TIME);
- memset(servers4,'\0',sizeof(in_addr) * 8);
- if (dns_aton4_s(dnsserver,&addr4) != NULL)
- memcpy(&servers4[i4++],&addr4,sizeof(in_addr));
+ in_addr addr4;
+ i4 = 0;
+ srand((unsigned int) TIME);
+ memset(servers4,'\0',sizeof(in_addr) * 8);
+ if (dns_aton4_s(dnsserver,&addr4) != NULL)
+ memcpy(&servers4[i4++],&addr4,sizeof(in_addr));
}
@@ -704,13 +704,13 @@ bool DNS::ReverseLookup(const std::string &ip)
{
if (ServerInstance && ServerInstance->stats)
ServerInstance->stats->statsDns++;
- binip = dns_aton4(ip.c_str());
- if (binip == NULL)
+ binip = dns_aton4(ip.c_str());
+ if (binip == NULL)
{
- return false;
- }
+ return false;
+ }
- this->myfd = dns_getname4(binip);
+ this->myfd = dns_getname4(binip);
if (this->myfd == -1)
{
return false;
@@ -784,14 +784,14 @@ int DNS::GetFD()
std::string DNS::GetResult()
{
log(DEBUG,"DNS: GetResult()");
- result = dns_getresult(this->myfd);
- if (result)
+ result = dns_getresult(this->myfd);
+ if (result)
{
if (ServerInstance && ServerInstance->stats)
ServerInstance->stats->statsDnsGood++;
dns_close(this->myfd);
return result;
- }
+ }
else
{
if (ServerInstance && ServerInstance->stats)
@@ -838,40 +838,40 @@ std::string DNS::GetResultIP()
#ifdef THREADED_DNS
void* dns_task(void* arg)
{
- userrec* u = (userrec*)arg;
- log(DEBUG,"DNS thread for user %s",u->nick);
- DNS dns1;
- DNS dns2;
- std::string host;
- std::string ip;
- if (dns1.ReverseLookup((char*)inet_ntoa(u->ip4)))
- {
- while (!dns1.HasResult())
- {
- usleep(100);
- }
- host = dns1.GetResult();
- if (host != "")
- {
- if (dns2.ForwardLookup(host))
- {
- while (!dns2.HasResult())
- {
- usleep(100);
- }
- ip = dns2.GetResultIP();
- if (ip == std::string((char*)inet_ntoa(u->ip4)))
- {
- if (host.length() < 160)
- {
- strcpy(u->host,host.c_str());
- strcpy(u->dhost,host.c_str());
- }
- }
- }
- }
- }
- u->dns_done = true;
- return NULL;
+ userrec* u = (userrec*)arg;
+ log(DEBUG,"DNS thread for user %s",u->nick);
+ DNS dns1;
+ DNS dns2;
+ std::string host;
+ std::string ip;
+ if (dns1.ReverseLookup((char*)inet_ntoa(u->ip4)))
+ {
+ while (!dns1.HasResult())
+ {
+ usleep(100);
+ }
+ host = dns1.GetResult();
+ if (host != "")
+ {
+ if (dns2.ForwardLookup(host))
+ {
+ while (!dns2.HasResult())
+ {
+ usleep(100);
+ }
+ ip = dns2.GetResultIP();
+ if (ip == std::string((char*)inet_ntoa(u->ip4)))
+ {
+ if (host.length() < 160)
+ {
+ strcpy(u->host,host.c_str());
+ strcpy(u->dhost,host.c_str());
+ }
+ }
+ }
+ }
+ }
+ u->dns_done = true;
+ return NULL;
}
#endif