summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-04-21 15:05:49 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-04-21 15:05:49 +0200
commit14d15d3d2a049b07e9cad2bc2970d1fa0d51af02 (patch)
tree2222401d7e13ae559e1a6e2e7ea8d96065dd1f07
parent8950aeda9a42ec795ce4edf87b40135047f55f6d (diff)
core_dns Allow usage of id 65535
-rw-r--r--src/coremods/core_dns.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index f4559c08f..58c275c7c 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -442,18 +442,18 @@ class MyManager : public Manager, public Timer, public EventHandler
}
public:
- DNS::Request* requests[MAX_REQUEST_ID];
+ DNS::Request* requests[MAX_REQUEST_ID+1];
MyManager(Module* c) : Manager(c), Timer(3600, true)
{
- for (int i = 0; i < MAX_REQUEST_ID; ++i)
+ for (unsigned int i = 0; i <= MAX_REQUEST_ID; ++i)
requests[i] = NULL;
ServerInstance->Timers.AddTimer(this);
}
~MyManager()
{
- for (int i = 0; i < MAX_REQUEST_ID; ++i)
+ for (unsigned int i = 0; i <= MAX_REQUEST_ID; ++i)
{
DNS::Request* request = requests[i];
if (!request)
@@ -476,14 +476,14 @@ class MyManager : public Manager, public Timer, public EventHandler
int id;
do
{
- id = ServerInstance->GenRandomInt(DNS::MAX_REQUEST_ID);
+ id = ServerInstance->GenRandomInt(DNS::MAX_REQUEST_ID+1);
if (++tries == DNS::MAX_REQUEST_ID*5)
{
// If we couldn't find an empty slot this many times, do a sequential scan as a last
// resort. If an empty slot is found that way, go on, otherwise throw an exception
id = -1;
- for (unsigned int i = 0; i < DNS::MAX_REQUEST_ID; i++)
+ for (unsigned int i = 0; i <= DNS::MAX_REQUEST_ID; i++)
{
if (!this->requests[i])
{
@@ -807,7 +807,7 @@ class ModuleDNS : public Module
void OnUnloadModule(Module* mod)
{
- for (int i = 0; i < MAX_REQUEST_ID; ++i)
+ for (unsigned int i = 0; i <= MAX_REQUEST_ID; ++i)
{
DNS::Request* req = this->manager.requests[i];
if (!req)