X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Ftreeserver.h;h=4465de15e4ea439563a86e0f4b3eae6eed2b4aab;hb=50ea7f41b2e4aca9ef9be31c056f862a7d90609a;hp=2e6c47bf4be066f39a60ab8693e3b58a7ec40584;hpb=5214968e7e0e0d43e137535ac1a9369c222d79f0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index 2e6c47bf4..4465de15e 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -60,6 +60,10 @@ class TreeServer : public Server */ unsigned int behind_bursting; + /** True if this server has been lost in a split and is awaiting destruction + */ + bool isdead; + /** This method is used to add this TreeServer to the * hash maps. It is only called by the constructors. */ @@ -67,7 +71,11 @@ class TreeServer : public Server /** Used by SQuit logic to recursively remove servers */ - void SQuitInternal(const std::string& reason, int& num_lost_servers, int& num_lost_users); + void SQuitInternal(unsigned int& num_lost_servers); + + /** Remove the reference to this server from the hash maps + */ + void RemoveHash(); public: typedef std::vector ChildServers; @@ -105,13 +113,13 @@ class TreeServer : public Server GetParent()->SQuitChild(this, reason); } - int QuitUsers(const std::string &reason); + static unsigned int QuitUsers(const std::string& reason); /** Get route. * The 'route' is defined as the locally- * connected server which can be used to reach this server. */ - TreeServer* GetRoute(); + TreeServer* GetRoute() const { return Route; } /** Returns true if this server is the tree root (i.e.: us) */ @@ -121,9 +129,14 @@ class TreeServer : public Server */ bool IsLocal() const { return (this->Route == this); } + /** Returns true if the server is awaiting destruction + * @return True if the server is waiting to be culled and deleted, false otherwise + */ + bool IsDead() const { return isdead; } + /** Get server version string */ - const std::string& GetVersion(); + const std::string& GetVersion() const { return VersionString; } /** Get the full version string of this server * @return The full version string of this server, including patch version and other info @@ -165,16 +178,16 @@ class TreeServer : public Server /** Get the TreeSocket pointer for local servers. * For remote servers, this returns NULL. */ - TreeSocket* GetSocket(); + TreeSocket* GetSocket() const { return Socket; } /** Get the parent server. * For the root node, this returns NULL. */ - TreeServer* GetParent(); + TreeServer* GetParent() const { return Parent; } /** Set the server version string */ - void SetVersion(const std::string &Version); + void SetVersion(const std::string& verstr) { VersionString = verstr; } /** Set the full version string * @param verstr The version string to set @@ -191,23 +204,9 @@ class TreeServer : public Server */ const ChildServers& GetChildren() const { return Children; } - /** Add a child server - */ - void AddChild(TreeServer* Child); - - /** Delete a child server, return false if it didn't exist. - */ - bool DelChild(TreeServer* Child); - - /** Removes child nodes of this node, and of that node, etc etc. - * This is used during netsplits to automatically tidy up the - * server tree. It is slow, we don't use it for much else. - */ - void Tidy(); - /** Get server ID */ - const std::string& GetID(); + const std::string& GetID() const { return sid; } /** Marks a server as having finished bursting and performs appropriate actions. */ @@ -237,9 +236,7 @@ class TreeServer : public Server CullResult cull(); - /** Destructor - * Removes the reference to this object from the - * hash maps. + /** Destructor, deletes ServerUser unless IsRoot() */ ~TreeServer();