diff options
-rw-r--r-- | src/inspircd.cpp | 13 | ||||
-rw-r--r-- | src/users.cpp | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 58c833902..8f757e047 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -73,6 +73,7 @@ extern int MODCOUNT; extern char LOG_FILE[MAXBUF]; int openSockfd[MAXSOCKS]; int yield_depth; +int iterations = 0; sockaddr_in client,server; socklen_t length; @@ -647,13 +648,22 @@ void InspIRCd::DoOneIteration(bool process_module_sockets) { expire_run = false; } + + if (iterations++ == 30) + { + iterations = 0; + DoBackgroundUserStuff(TIME); + } /* Once a second, do the background processing */ if (TIME != OLDTIME) { if (TIME < OLDTIME) WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME)); - DoBackgroundUserStuff(TIME); + if ((TIME % 3600) == 0) + { + MaintainWhoWas(TIME); + } } /* Process timeouts on module sockets each time around @@ -816,6 +826,7 @@ int InspIRCd::Run() /* main loop, this never returns */ expire_run = false; yield_depth = 0; + iterations = 0; while (true) { diff --git a/src/users.cpp b/src/users.cpp index 83800e01d..94ed97d93 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -518,6 +518,8 @@ void AddWhoWas(userrec* u) whowas_set* group = (whowas_set*)iter->second; if (group->size() > 10) { + WhoWasGroup *a = (WhoWasGroup*)*(group->begin()); + delete a; group->pop_front(); } WhoWasGroup *a = new WhoWasGroup(u); |