diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/base.cpp | 6 | ||||
-rw-r--r-- | src/cull_list.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.cpp | 47 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.h | 20 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket.h | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 5 |
6 files changed, 21 insertions, 65 deletions
diff --git a/src/base.cpp b/src/base.cpp index 0441217d1..67b136ec8 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -23,7 +23,9 @@ #include "inspircd.h" #include "base.h" #include <time.h> +#ifdef INSPIRCD_ENABLE_RTTI #include <typeinfo> +#endif classbase::classbase() { @@ -34,8 +36,12 @@ classbase::classbase() CullResult classbase::cull() { if (ServerInstance) +#ifdef INSPIRCD_ENABLE_RTTI ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "classbase::-%s @%p", typeid(*this).name(), (void*)this); +#else + ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "classbase::- @%p", (void*)this); +#endif return CullResult(); } diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 5cbe3aef3..73f2def51 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -21,7 +21,9 @@ #include "inspircd.h" +#ifdef INSPIRCD_ENABLE_RTTI #include <typeinfo> +#endif void CullList::Apply() { @@ -46,8 +48,12 @@ void CullList::Apply() classbase* c = list[i]; if (gone.insert(c).second) { +#ifdef INSPIRCD_ENABLE_RTTI ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "Deleting %s @%p", typeid(*c).name(), (void*)c); +#else + ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "Deleting @%p", (void*)c); +#endif c->cull(); queue.push_back(c); } diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 98d7c8754..534315ff7 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -112,7 +112,7 @@ TreeServer::TreeServer(const std::string& Name, const std::string& Desc, const s */ this->AddHashEntry(); - Parent->AddChild(this); + Parent->Children.push_back(this); } void TreeServer::BeginBurst(unsigned long startms) @@ -127,11 +127,6 @@ void TreeServer::BeginBurst(unsigned long startms) ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Server %s started bursting at time %lu behind_bursting %u", sid.c_str(), startms, behind_bursting); } -const std::string& TreeServer::GetID() -{ - return sid; -} - void TreeServer::FinishBurstInternal() { // Check is needed because 1202 protocol servers don't send the bursting state of a server, so servers @@ -168,7 +163,7 @@ void TreeServer::FinishBurst() void TreeServer::SQuitChild(TreeServer* server, const std::string& reason) { DelServerEvent(Utils->Creator, server->GetName()); - DelChild(server); + stdalgo::erase(Children, server); if (IsRoot()) { @@ -266,19 +261,6 @@ void TreeServer::AddHashEntry() Utils->sidlist[sid] = this; } -/** These accessors etc should be pretty self- - * explanitory. - */ -TreeServer* TreeServer::GetRoute() -{ - return Route; -} - -const std::string& TreeServer::GetVersion() -{ - return VersionString; -} - void TreeServer::SetNextPingTime(time_t t) { this->NextPing = t; @@ -300,31 +282,6 @@ void TreeServer::SetPingFlag() LastPingWasGood = true; } -TreeSocket* TreeServer::GetSocket() -{ - return Socket; -} - -TreeServer* TreeServer::GetParent() -{ - return Parent; -} - -void TreeServer::SetVersion(const std::string &Version) -{ - VersionString = Version; -} - -void TreeServer::AddChild(TreeServer* Child) -{ - Children.push_back(Child); -} - -bool TreeServer::DelChild(TreeServer* Child) -{ - return stdalgo::erase(Children, Child); -} - CullResult TreeServer::cull() { // Recursively cull all servers that are under us in the tree diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index f06e0bafa..4465de15e 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -119,7 +119,7 @@ class TreeServer : public Server * 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) */ @@ -136,7 +136,7 @@ class TreeServer : public Server /** 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 @@ -178,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 @@ -204,17 +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); - /** 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. */ diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 6dc584537..4887623c1 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -174,7 +174,7 @@ class TreeSocket : public BufferedSocket /** Get link state */ - ServerState GetLinkState(); + ServerState GetLinkState() const { return LinkState; } /** Get challenge set in our CAPAB for challenge/response */ diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index d2fec0118..025bd1e61 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -69,11 +69,6 @@ TreeSocket::TreeSocket(int newfd, ListenSocket* via, irc::sockets::sockaddrs* cl Utils->timeoutlist[this] = std::pair<std::string, int>(linkID, 30); } -ServerState TreeSocket::GetLinkState() -{ - return this->LinkState; -} - void TreeSocket::CleanNegotiationInfo() { // connect is good, reset the autoconnect block (if used) |