summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-30 17:12:08 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-30 17:12:08 +0000
commit4a64082e31c3c3dfa97a1edfb8a3c97fe8d32ea7 (patch)
treeabe1f2293fae907540a1feb609b4b2a5888616af /src/users.cpp
parent5fd6471070ecf0f9a0074714c57211e922257014 (diff)
Move destruction logic for User and Spanningtree into cull()
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11783 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp66
1 files changed, 37 insertions, 29 deletions
diff --git a/src/users.cpp b/src/users.cpp
index fb36ac324..f5eeff942 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -235,35 +235,8 @@ User::User(const std::string &uid)
User::~User()
{
- ServerInstance->Logs->Log("USERS", DEBUG, "User destructor for %s", uuid.c_str());
- /* NULL for remote users :) */
- if (this->MyClass)
- {
- this->MyClass->RefCount--;
- ServerInstance->Logs->Log("USERS", DEBUG, "User destructor -- connect refcount now: %lu", this->MyClass->RefCount);
- if (MyClass->RefCount == 0)
- delete MyClass;
- }
-
- if (this->AllowedOperCommands)
- {
- delete AllowedOperCommands;
- AllowedOperCommands = NULL;
- }
-
- if (this->AllowedPrivs)
- {
- delete AllowedPrivs;
- AllowedPrivs = NULL;
- }
-
- this->InvalidateCache();
- this->DecrementModes();
-
- if (client_sa.sa.sa_family != AF_UNSPEC)
- ServerInstance->Users->RemoveCloneCounts(this);
-
- ServerInstance->Users->uuidlist->erase(uuid);
+ if (uuid.length())
+ ServerInstance->Logs->Log("USERS", ERROR, "User destructor for %s called without cull", uuid.c_str());
}
const std::string& User::MakeHost()
@@ -599,6 +572,12 @@ void User::cull()
{
if (!quitting)
ServerInstance->Users->QuitUser(this, "Culled without QuitUser");
+ if (uuid.empty())
+ {
+ ServerInstance->Logs->Log("USERS", DEBUG, "User culled twice? UUID empty");
+ return;
+ }
+ PurgeEmptyChannels();
if (IS_LOCAL(this))
{
if (fd != INT_MAX)
@@ -610,6 +589,35 @@ void User::cull()
else
ServerInstance->Logs->Log("USERS", DEBUG, "Failed to remove user from vector");
}
+
+ if (this->MyClass)
+ {
+ this->MyClass->RefCount--;
+ ServerInstance->Logs->Log("USERS", DEBUG, "User destructor -- connect refcount now: %lu", this->MyClass->RefCount);
+ if (MyClass->RefCount == 0)
+ delete MyClass;
+ }
+
+ if (this->AllowedOperCommands)
+ {
+ delete AllowedOperCommands;
+ AllowedOperCommands = NULL;
+ }
+
+ if (this->AllowedPrivs)
+ {
+ delete AllowedPrivs;
+ AllowedPrivs = NULL;
+ }
+
+ this->InvalidateCache();
+ this->DecrementModes();
+
+ if (client_sa.sa.sa_family != AF_UNSPEC)
+ ServerInstance->Users->RemoveCloneCounts(this);
+
+ ServerInstance->Users->uuidlist->erase(uuid);
+ uuid.clear();
}
void User::Oper(const std::string &opertype, const std::string &opername)