From 72fe978b29fa7d9fd7f8e9c2766c06ab1a0a8bc7 Mon Sep 17 00:00:00 2001 From: w00t Date: Wed, 16 Jan 2008 09:14:23 +0000 Subject: Two stage commit: don't set user->muted except in QuitUser (duplicate setting), also, change muted to drop all socket operations instead of just not reading the user's buffer if muted is set (no point wasting time - they're going away). Also revert culllist back to once per mainloop iteration now it is much cheaper than previously. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8716 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/command_parse.cpp | 8 +++----- src/commands/cmd_kill.cpp | 1 - src/inspircd.cpp | 6 +++--- src/userprocess.cpp | 2 -- src/users.cpp | 5 +++-- 5 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/command_parse.cpp b/src/command_parse.cpp index d82f523db..82209015c 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -413,12 +413,10 @@ bool CommandParser::ProcessBuffer(std::string &buffer,User *user) if (buffer.length()) { - if (!user->muted) - { - ServerInstance->Log(DEBUG,"C[%d] I :%s %s",user->GetFd(), user->nick, buffer.c_str()); - return this->ProcessCommand(user,buffer); - } + ServerInstance->Log(DEBUG,"C[%d] I :%s %s",user->GetFd(), user->nick, buffer.c_str()); + return this->ProcessCommand(user,buffer); } + return true; } diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 9b4dbbf1a..675532a3c 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -98,7 +98,6 @@ CmdResult CommandKill::Handle (const char** parameters, int pcnt, User *user) user->dhost, *ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : user->nick, parameters[1]); - u->muted = true; } } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 8b56706dd..9318a03fd 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -625,9 +625,6 @@ int InspIRCd::Run() */ if (TIME != OLDTIME) { - /* if any users were quit, take them out */ - this->GlobalCulls.Apply(); - if (TIME < OLDTIME) { WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME)); @@ -677,6 +674,9 @@ int InspIRCd::Run() */ this->SE->DispatchEvents(); + /* if any users were quit, take them out */ + this->GlobalCulls.Apply(); + /* If any inspsockets closed, remove them */ this->BufferedSocketCull(); diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 7a1938d2c..5ec2581f7 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -190,7 +190,6 @@ void InspIRCd::DoBackgroundUserStuff() * registration timeout -- didnt send USER/NICK/HOST * in the time specified in their connection class. */ - curr->muted = true; User::QuitUser(this, curr, "Registration timeout"); continue; } @@ -220,7 +219,6 @@ void InspIRCd::DoBackgroundUserStuff() time_t time = this->Time(false) - (curr->nping - curr->MyClass->GetPingTime()); char message[MAXBUF]; snprintf(message, MAXBUF, "Ping timeout: %ld second%s", (long)time, time > 1 ? "s" : ""); - curr->muted = true; curr->lastping = 1; curr->nping = TIME + curr->MyClass->GetPingTime(); User::QuitUser(this, curr, message); diff --git a/src/users.cpp b/src/users.cpp index f2c2d9ae4..538f8d33b 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -785,7 +785,6 @@ void User::FullConnect() if (r) { - this->muted = true; r->Apply(this); return; } @@ -794,7 +793,6 @@ void User::FullConnect() if (n) { - this->muted = true; n->Apply(this); return; } @@ -1702,6 +1700,9 @@ void User::ShowRULES() void User::HandleEvent(EventType et, int errornum) { + if (this->muted) // drop everything, user is due to be quit + return; + /* WARNING: May delete this user! */ int thisfd = this->GetFd(); -- cgit v1.2.3