summaryrefslogtreecommitdiff
path: root/src/dns.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-02-13 00:10:45 -0500
committerAdam <Adam@anope.org>2012-02-13 00:10:45 -0500
commit086790d6331357022f4da17c76b26b9fc6e2ad90 (patch)
treee82d9e0b67cfc5ad0251d8bdcd2490207a875fc6 /src/dns.cpp
parent1bc8e2ab82db9ce00faaa44887338873a2cd9210 (diff)
Removed our RNG and just use the systems, it's not very widely used. Also made DNS query ids not random as they don't need to be.
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index 02df2aea4..fc1ab37df 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -52,8 +52,11 @@ DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache, Modu
throw SocketException("DNS queue full");
do
- this->id = getrandom16();
- while (!this->id || DNSEngine->requests.count(this->id));
+ {
+ static unsigned short cur_id = 0;
+ this->id = cur_id++;
+ }
+ while (DNSEngine->requests.count(this->id));
DNSEngine->requests[this->id] = this;
}
@@ -457,7 +460,7 @@ DNSManager::~DNSManager()
delete this->packets[i - 1];
this->packets.clear();
- for (std::map<short, DNSRequest *>::iterator it = this->requests.begin(), it_end = this->requests.end(); it != it_end; ++it)
+ for (std::map<unsigned short, DNSRequest *>::iterator it = this->requests.begin(), it_end = this->requests.end(); it != it_end; ++it)
{
DNSRequest *request = it->second;
@@ -504,7 +507,7 @@ bool DNSManager::ProcessRead()
return true;
}
- std::map<short, DNSRequest *>::iterator it = DNSEngine->requests.find(recv_packet.id);
+ std::map<unsigned short, DNSRequest *>::iterator it = DNSEngine->requests.find(recv_packet.id);
if (it == DNSEngine->requests.end())
{
Log(LOG_DEBUG_2) << "Resolver: Received an answer for something we didn't request";
@@ -652,9 +655,9 @@ void DNSManager::Tick(time_t now)
void DNSManager::Cleanup(Module *mod)
{
- for (std::map<short, DNSRequest *>::iterator it = this->requests.begin(), it_end = this->requests.end(); it != it_end;)
+ for (std::map<unsigned short, DNSRequest *>::iterator it = this->requests.begin(), it_end = this->requests.end(); it != it_end;)
{
- short id = it->first;
+ unsigned short id = it->first;
DNSRequest *req = it->second;
++it;