diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-17 21:21:33 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-17 21:21:33 +0000 |
commit | 79961a8903605d64195c531b9a68b01fbbb1042e (patch) | |
tree | 440e4eaac040e482575fbf418ec77cfb7b350eb2 /src/inspircd.cpp | |
parent | 95fa07b5c6d4ac2b1f9c1abef9a512ca9ddff7f5 (diff) |
Optimize tons more timer checking stuff
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4938 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r-- | src/inspircd.cpp | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 69f812d55..92c05f557 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -322,12 +322,6 @@ InspIRCd::InspIRCd(int argc, char** argv) printf("\nInspIRCd is now running!\n"); this->WritePID(Config->PID); - - /* main loop, this never returns */ - expire_run = false; - iterations = 0; - - return; } std::string InspIRCd::GetVersionString() @@ -688,35 +682,12 @@ void InspIRCd::DoOneIteration(bool process_module_sockets) */ OLDTIME = TIME; TIME = time(NULL); - + /* Run background module timers every few seconds * (the docs say modules shouldnt rely on accurate * timing using this event, so we dont have to * time this exactly). */ - if (((TIME % 5) == 0) && (!expire_run)) - { - XLines->expire_lines(); - if (process_module_sockets) - { - FOREACH_MOD_I(this,I_OnBackgroundTimer,OnBackgroundTimer(TIME)); - } - Timers->TickMissedTimers(TIME); - expire_run = true; - return; - } - else if ((TIME % 5) == 1) - { - expire_run = false; - } - - if (iterations++ == 15) - { - iterations = 0; - this->DoBackgroundUserStuff(TIME); - } - - /* Once a second, do the background processing */ if (TIME != OLDTIME) { if (TIME < OLDTIME) @@ -728,13 +699,15 @@ void InspIRCd::DoOneIteration(bool process_module_sockets) Timers->TickTimers(TIME); if (process_module_sockets) this->DoSocketTimeouts(TIME); - } + this->DoBackgroundUserStuff(TIME); - /* Process timeouts on module sockets each time around - * the loop. There shouldnt be many module sockets, at - * most, 20 or so, so this won't be much of a performance - * hit at all. - */ + if ((TIME % 5) == 0) + { + XLines->expire_lines(); + FOREACH_MOD_I(this,I_OnBackgroundTimer,OnBackgroundTimer(TIME)); + Timers->TickMissedTimers(TIME); + } + } /* Call the socket engine to wait on the active * file descriptors. The socket engine has everything's |