summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_pgsql.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-04-09 23:51:06 +0200
committerattilamolnar <attilamolnar@hush.com>2013-04-21 18:00:09 +0200
commit1638ee61936bc91758be39c3463c6e46d0d655e7 (patch)
tree3ad0357587a58bc3845cb3a328bf3e95fadf2923 /src/modules/extra/m_pgsql.cpp
parente9e75e50bc25e67af22dd88b39b12217a553d5cb (diff)
Timer changes and TimerManager enhancements
Timer::Tick() now has a bool return value: if false is returned the timer is deleted using operator delete, otherwise, if it's a repeating timer then it's rescheduled (readded) Timers are removed from the TimerManager automatically at destruction Timers are now stored in a multimap instead of a sorted vector
Diffstat (limited to 'src/modules/extra/m_pgsql.cpp')
-rw-r--r--src/modules/extra/m_pgsql.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 6d2e0c88a..4690f9851 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -62,7 +62,7 @@ class ReconnectTimer : public Timer
ReconnectTimer(ModulePgSQL* m) : Timer(5, ServerInstance->Time(), false), mod(m)
{
}
- virtual void Tick(time_t TIME);
+ virtual bool Tick(time_t TIME);
};
struct QueueItem
@@ -504,6 +504,11 @@ class ModulePgSQL : public Module
ConnMap connections;
ReconnectTimer* retimer;
+ ModulePgSQL()
+ : retimer(NULL)
+ {
+ }
+
void init()
{
ReadConf();
@@ -514,8 +519,7 @@ class ModulePgSQL : public Module
virtual ~ModulePgSQL()
{
- if (retimer)
- ServerInstance->Timers->DelTimer(retimer);
+ delete retimer;
ClearAllConnections();
}
@@ -594,10 +598,11 @@ class ModulePgSQL : public Module
}
};
-void ReconnectTimer::Tick(time_t time)
+bool ReconnectTimer::Tick(time_t time)
{
mod->retimer = NULL;
mod->ReadConf();
+ return false;
}
void SQLConn::DelayReconnect()