1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 02:43:13 +02:00

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+

This commit is contained in:
Adam
2013-09-16 06:28:48 -04:00
parent 8cbaf7e990
commit e3c05efe5e
7 changed files with 74 additions and 59 deletions
+5 -4
View File
@@ -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));