diff options
author | Adam <Adam@anope.org> | 2013-09-16 06:28:48 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-09-16 06:47:42 -0400 |
commit | e3c05efe5e5085f3db14f1532a92de460b899ab5 (patch) | |
tree | a486474c1eff7e04a7167c1d069d23a93406e171 /modules/m_dns.cpp | |
parent | 8cbaf7e9904e3cc6aca22566c83ea25959357d48 (diff) |
Remove static variables from functions in modules which causes them to be marked as gnu unique objects, which breaks dlclose()/dlopen() on g++ 4.5+
Diffstat (limited to 'modules/m_dns.cpp')
-rw-r--r-- | modules/m_dns.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/m_dns.cpp b/modules/m_dns.cpp index 214e97cf4..01524d1ca 100644 --- a/modules/m_dns.cpp +++ b/modules/m_dns.cpp @@ -281,7 +281,7 @@ class Packet : public Query if (q.name.find(':') != Anope::string::npos) { - static const char *const hex = "0123456789abcdef"; + const char *const hex = "0123456789abcdef"; char reverse_ip[128]; unsigned reverse_ip_count = 0; for (int j = 15; j >= 0; --j) @@ -662,7 +662,8 @@ class MyManager : public Manager, public Timer public: std::map<unsigned short, Request *> requests; - MyManager(Module *creator) : Manager(creator), Timer(300, Anope::CurTime, true), serial(Anope::CurTime), tcpsock(NULL), udpsock(NULL), listen(false) + MyManager(Module *creator) : Manager(creator), Timer(300, Anope::CurTime, true), serial(Anope::CurTime), tcpsock(NULL), udpsock(NULL), + listen(false), cur_id(rand()) { } @@ -717,13 +718,13 @@ class MyManager : public Manager, public Timer } private: + unsigned short cur_id; + unsigned short GetID() { if (this->udpsock->GetPackets().size() == 65535) throw SocketException("DNS queue full"); - static unsigned short cur_id = rand(); - do cur_id = (cur_id + 1) & 0xFFFF; while (!cur_id || this->requests.count(cur_id)); |