#include "inspircd_se_config.h"
#endif
-#include "dns.h"
#include "inspircd.h"
#include "socketengine.h"
#include "configreader.h"
RequestTimeout(unsigned long n, InspIRCd* SI, DNSRequest* watching, int id) : Timer(n, SI->Time()), ServerInstance(SI), watch(watching), watchid(id)
{
}
+ ~RequestTimeout()
+ {
+ if (ServerInstance->Res)
+ Tick(0);
+ }
void Tick(time_t)
{
}
ServerInstance->Res->requests[watchid] = NULL;
delete watch;
- return;
}
}
};
DNS::EmptyHeader(payload,header,length);
-#ifdef IPV6
if (this->dnsobj->socketfamily == AF_INET6)
{
sockaddr_in6 addr;
return -1;
}
else
-#endif
{
sockaddr_in addr;
memset(&addr,0,sizeof(addr));
}
this->socketfamily = AF_INET;
-#ifdef IPV6
if (strchr(ServerInstance->Config->DNSServer,':'))
{
this->socketfamily = AF_INET6;
inet_aton(ServerInstance->Config->DNSServer, &this->myserver4);
portpass = -1;
}
-#else
- inet_aton(ServerInstance->Config->DNSServer, &this->myserver4);
-#endif
/* Initialize mastersocket */
int s = irc::sockets::OpenTCPSocket(ServerInstance->Config->DNSServer, SOCK_DGRAM);
*
* -- Thanks jilles for pointing this one out.
*/
-#ifdef IPV6
char nbuf[MAXBUF];
if (this->socketfamily == AF_INET6)
{
port_from = ntohs(from.in6.sin6_port);
}
else
-#endif
{
ipaddr_from = inet_ntoa(from.in4.sin_addr);
port_from = ntohs(from.in4.sin_port);
ServerInstance->SE->Shutdown(this, 2);
ServerInstance->SE->Close(this);
ServerInstance->Timers->DelTimer(this->PruneTimer);
+ if (cache)
+ delete cache;
}
CachedQuery* DNS::GetCache(const std::string &source)