#include <arpa/inet.h>
#include "dns.h"
#include "helperfuncs.h"
+#include "socketengine.h"
+
+extern SocketEngine* SE;
extern int statsAccept,statsRefused,statsUnknown,statsCollisions,statsDns,statsDnsGood,statsDnsBad,statsConnects,statsSent,statsRecv;
return false;
}
log(DEBUG,"DNS: ReverseLookup, fd=%d",this->myfd);
+#ifndef THREADED_DNS
+ SE->AddFd(this->myfd,true,X_ESTAB_DNS);
+#endif
return true;
}
return false;
}
log(DEBUG,"DNS: ForwardLookup, fd=%d",this->myfd);
+#ifndef THREADED_DNS
+ SE->AddFd(this->myfd,true,X_ESTAB_DNS);
+#endif
return true;
}
+bool DNS::HasResult(int fd)
+{
+ return (fd == this->myfd);
+}
+
+/* Only the multithreaded dns uses this poll() based
+ * check now. As its in another thread we dont have
+ * to worry about its performance that much.
+ */
bool DNS::HasResult()
{
log(DEBUG,"DNS: HasResult, fd=%d",this->myfd);
{
log(DEBUG,"DNS: GetResult()");
result = dns_getresult(this->myfd);
+#ifndef THREADED_DNS
+ SE->DelFd(this->myfd);
+#endif
if (result) {
statsDnsGood++;
dns_close(this->myfd);
result = dns_getresult(this->myfd);
if (this->myfd != -1)
{
+#ifndef THREADED_DNS
+ SE->DelFd(this->myfd);
+#endif
dns_close(this->myfd);
}
if (result)