summaryrefslogtreecommitdiff
path: root/src/dns.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-09-10 20:31:31 -0400
committerAdam <Adam@anope.org>2010-09-10 20:31:31 -0400
commitf00e76d30a86acf0f18bcde5647eedd50de50569 (patch)
tree04af81a883ea6e71ec36e35a2822487c7f8192c6 /src/dns.cpp
parent9eb7562bee7f2a52cf91b0ab0ebc10351f2a46f2 (diff)
Added Anope::CurTime to keep us from calling time() everywhere
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index 51cd14938..329c03c86 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -192,7 +192,7 @@ inline DNSRecord::DNSRecord()
{
this->type = DNS_QUERY_NONE;
this->record_class = this->ttl = this->rdlength = 0;
- this->created = time(NULL);
+ this->created = Anope::CurTime;
}
DNSSocket::DNSSocket(const Anope::string &nTargetHost, int nPort) : ClientSocket(nTargetHost, nPort, "", false, SOCK_DGRAM)
@@ -471,7 +471,7 @@ bool DNSSocket::ProcessWrite()
return cont;
}
-DNSManager::DNSManager() : Timer(3600, time(NULL), true)
+DNSManager::DNSManager() : Timer(3600, Anope::CurTime, true)
{
this->sock = NULL;
@@ -502,11 +502,10 @@ bool DNSManager::CheckCache(DNSRequest *request)
{
std::multimap<Anope::string, DNSRecord *>::iterator it_end = this->cache.upper_bound(request->address);
- time_t now = time(NULL);
for (; it != it_end; ++it)
{
DNSRecord *rec = it->second;
- if (rec->created + rec->ttl >= now)
+ if (rec->created + rec->ttl >= Anope::CurTime)
{
request->OnLookupComplete(rec);
}