]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/dns.cpp
Moved to B3 official
[user/henk/code/inspircd.git] / src / dns.cpp
index 30d05e2a3d686cacf0f93b8e869129810e629469..6788937c60a0209f2f009882177a3760edddacda 100644 (file)
@@ -180,7 +180,6 @@ void DNS::dns_init() { /* on first call only: populates servers4 struct with up
                }
        }
        fclose(f);
-
 }
 
 void DNS::dns_init_2(const char* dnsserver) { /* populates servers4 struct with address from the given parameter */
@@ -188,11 +187,7 @@ void DNS::dns_init_2(const char* dnsserver) { /* populates servers4 struct with
         int i;
         in_addr addr4;
         char buf[1024];
-        if (initdone == 1)
-                return;
         i4 = 0;
-
-        initdone = 1;
         srand((unsigned int) TIME);
         memset(servers4,'\0',sizeof(in_addr) * DNS_MAX);
         if (dns_aton4_s(dnsserver,&addr4) != NULL)
@@ -686,6 +681,11 @@ DNS::DNS(std::string dnsserver)
        dns_init_2(dnsserver.c_str());
 }
 
+void DNS::SetNS(std::string dnsserver)
+{
+       dns_init_2(dnsserver.c_str());
+}
+
 DNS::~DNS()
 {
 }
@@ -724,6 +724,7 @@ std::string DNS::GetResult()
 {
         result = dns_getresult(this->fd);
         if (result) {
+               dns_close(this->fd);
                return result;
         } else {
                return "";