From 1638ee61936bc91758be39c3463c6e46d0d655e7 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 9 Apr 2013 23:51:06 +0200 Subject: 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 --- src/dns.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/dns.cpp') diff --git a/src/dns.cpp b/src/dns.cpp index 461722b29..b9c605e78 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -123,9 +123,10 @@ class CacheTimer : public Timer CacheTimer(DNS* thisdns) : Timer(3600, ServerInstance->Time(), true), dns(thisdns) { } - virtual void Tick(time_t) + virtual bool Tick(time_t) { dns->PruneCache(); + return true; } }; @@ -143,7 +144,7 @@ class RequestTimeout : public Timer Tick(0); } - void Tick(time_t) + bool Tick(time_t) { if (ServerInstance->Res->requests[watchid] == watch) { @@ -157,6 +158,7 @@ class RequestTimeout : public Timer ServerInstance->Res->requests[watchid] = NULL; delete watch; } + return false; } }; -- cgit v1.2.3