diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-16 21:28:09 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-16 21:28:09 +0000 |
commit | 69f280701b651fcbdc22f68db1714c384b9098f4 (patch) | |
tree | bffe3f192e91a73805d4e54e1b981a9799af7e76 /src/dns.cpp | |
parent | 93a796af16530f1895f0b6c5f9baca9c7c1e1bbf (diff) |
Tweaks for nonblocking dns
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4432 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dns.cpp')
-rw-r--r-- | src/dns.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index f2acf05a6..0347caaae 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -851,6 +851,8 @@ std::string DNS::GetResultIP() void* dns_task(void* arg) { userrec* u = (userrec*)arg; + int thisfd = u->fd; + log(DEBUG,"DNS thread for user %s",u->nick); DNS dns1; DNS dns2; @@ -872,18 +874,22 @@ void* dns_task(void* arg) usleep(100); } ip = dns2.GetResultIP(); - if (ip == std::string((char*)inet_ntoa(u->ip4))) + if (ip == std::string(inet_ntoa(u->ip4))) { if (host.length() < 160) { - strcpy(u->host,host.c_str()); - strcpy(u->dhost,host.c_str()); + if ((fd_ref_table[thisfd] == u) && (fd_ref_table[thisfd])) + { + strcpy(u->host,host.c_str()); + strcpy(u->dhost,host.c_str()); + } } } } } } - u->dns_done = true; + if ((fd_ref_table[thisfd] == u) && (fd_ref_table[thisfd])) + u->dns_done = true; return NULL; } #endif |