diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-04-09 23:51:06 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-04-21 18:00:09 +0200 |
commit | 1638ee61936bc91758be39c3463c6e46d0d655e7 (patch) | |
tree | 3ad0357587a58bc3845cb3a328bf3e95fadf2923 /src/modules/m_spanningtree | |
parent | e9e75e50bc25e67af22dd88b39b12217a553d5cb (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/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/cachetimer.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_spanningtree/cachetimer.h | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/modules/m_spanningtree/cachetimer.cpp b/src/modules/m_spanningtree/cachetimer.cpp index 6703e84b1..4fdc7056f 100644 --- a/src/modules/m_spanningtree/cachetimer.cpp +++ b/src/modules/m_spanningtree/cachetimer.cpp @@ -24,12 +24,13 @@ /* $ModDep: m_spanningtree/cachetimer.h m_spanningtree/utils.h */ -CacheRefreshTimer::CacheRefreshTimer(SpanningTreeUtilities *Util) : Timer(3600, ServerInstance->Time(), true), Utils(Util) +CacheRefreshTimer::CacheRefreshTimer(SpanningTreeUtilities* Util) : Timer(3600, ServerInstance->Time(), true), Utils(Util) { } -void CacheRefreshTimer::Tick(time_t TIME) +bool CacheRefreshTimer::Tick(time_t TIME) { Utils->RefreshIPCache(); + return true; } diff --git a/src/modules/m_spanningtree/cachetimer.h b/src/modules/m_spanningtree/cachetimer.h index acfb7434c..5d2278cd6 100644 --- a/src/modules/m_spanningtree/cachetimer.h +++ b/src/modules/m_spanningtree/cachetimer.h @@ -31,5 +31,5 @@ class CacheRefreshTimer : public Timer SpanningTreeUtilities *Utils; public: CacheRefreshTimer(SpanningTreeUtilities* Util); - virtual void Tick(time_t TIME); + virtual bool Tick(time_t TIME); }; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index bd49a3075..029f5e888 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -70,7 +70,7 @@ void ModuleSpanningTree::init() ServerInstance->Modules->AddService(commands->fhost); ServerInstance->Modules->AddService(commands->fident); ServerInstance->Modules->AddService(commands->fname); - RefreshTimer = new CacheRefreshTimer(Utils); + RefreshTimer = new CacheRefreshTimer(this, Utils); ServerInstance->Timers->AddTimer(RefreshTimer); Implementation eventlist[] = @@ -907,6 +907,7 @@ CullResult ModuleSpanningTree::cull() { Utils->cull(); ServerInstance->Timers->DelTimer(RefreshTimer); + delete RefreshTimer; return this->Module::cull(); } |