summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-07 19:37:04 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-07 19:37:04 +0000
commit4ae5336d9b1ee086301da10345e25b117880129d (patch)
tree607a39ff178c009cffceb9eb66b70c59ad6d967e
parent0e93bbd2c9978dccf94a1b62085d56bf75a31a36 (diff)
Flush user buffers more often (every 30 iterations)
Run whowas hash maintainance every hour git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3527 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/inspircd.cpp13
-rw-r--r--src/users.cpp2
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);