summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJackmcbarn <jackmcbarn@jackmcbarn.no-ip.org>2011-05-23 21:51:08 -0400
committerJackmcbarn <jackmcbarn@jackmcbarn.no-ip.org>2011-05-23 21:51:08 -0400
commit58ab072505fcc58e35799065c42fb7112c4aed3f (patch)
tree793f7ab5305c7a2fe56ab7ca36bd8705695323a0 /src
parentf5409f04cd9fdb99cf4484785a2b14628464b538 (diff)
Fix recursion of QuitUser in SendQ quits
Diffstat (limited to 'src')
-rw-r--r--src/cull_list.cpp13
-rw-r--r--src/users.cpp12
2 files changed, 18 insertions, 7 deletions
diff --git a/src/cull_list.cpp b/src/cull_list.cpp
index 4f70ca466..d1b7ddc9f 100644
--- a/src/cull_list.cpp
+++ b/src/cull_list.cpp
@@ -16,6 +16,19 @@
void CullList::Apply()
{
+ std::vector<LocalUser *> working;
+ while (!SQlist.empty())
+ {
+ working.swap(SQlist);
+ for(std::vector<LocalUser *>::iterator a = working.begin(); a != working.end(); a++)
+ {
+ LocalUser *u = *a;
+ ServerInstance->SNO->WriteGlobalSno('a', "User %s SendQ exceeds connect class maximum of %lu",
+ u->nick.c_str(), u->MyClass->GetSendqHardMax());
+ ServerInstance->Users->QuitUser(u, "SendQ exceeded");
+ }
+ working.clear();
+ }
std::set<classbase*> gone;
std::vector<classbase*> queue;
queue.reserve(list.size() + 32);
diff --git a/src/users.cpp b/src/users.cpp
index 5ff890fd7..fe6f3915b 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -193,6 +193,7 @@ User::User(const std::string &uid, const std::string& sid, int type)
signon = idle_lastmsg = 0;
registered = 0;
quietquit = quitting = exempt = dns_done = false;
+ quitting_sendq = false;
client_sa.sa.sa_family = AF_UNSPEC;
ServerInstance->Logs->Log("USERS", DEBUG, "New UUID for user: %s", uuid.c_str());
@@ -519,16 +520,13 @@ eol_found:
void UserIOHandler::AddWriteBuf(const std::string &data)
{
+ if (user->quitting_sendq)
+ return;
if (!user->quitting && getSendQSize() + data.length() > user->MyClass->GetSendqHardMax() &&
!user->HasPrivPermission("users/flood/increased-buffers"))
{
- /*
- * Quit the user FIRST, because otherwise we could recurse
- * here and hit the same limit.
- */
- ServerInstance->Users->QuitUser(user, "SendQ exceeded");
- ServerInstance->SNO->WriteToSnoMask('a', "User %s SendQ exceeds connect class maximum of %lu",
- user->nick.c_str(), user->MyClass->GetSendqHardMax());
+ user->quitting_sendq = true;
+ ServerInstance->GlobalCulls.AddSQItem(user);
return;
}