summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-27 21:57:00 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-27 21:57:00 +0000
commit81007f78935f9c39930c94acec00afb4271b0dfe (patch)
tree5b937496c586e9c42383e70e1e73f39145668fff /src
parent87f6079b5ca4038201319ad0a6241dc2f2cb310e (diff)
Add bool TreeSocket::DuplicateID(), as its not safe to throw then try and squit that server :p
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7922 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp12
-rw-r--r--src/modules/m_spanningtree/treeserver.h5
2 files changed, 14 insertions, 3 deletions
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index 1d29bd3c2..4204c2224 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -36,7 +36,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, const st
VersionString.clear();
UserCount = OperCount = 0;
rtt = LastPing = 0;
- Hidden = false;
+ Hidden = DupError = false;
VersionString = ServerInstance->GetVersionString();
SetID(id);
}
@@ -56,7 +56,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str
Route = NULL;
Socket = NULL; /* Fix by brain */
rtt = LastPing = 0;
- Hidden = false;
+ Hidden = DupError = false;
AddHashEntry();
SetID(id);
}
@@ -72,6 +72,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str
UserCount = OperCount = 0;
this->SetNextPingTime(time(NULL) + Utils->PingFreq);
this->SetPingFlag();
+ DupError = false;
rtt = LastPing = 0;
/* find the 'route' for this server (e.g. the one directly connected
* to the local server, which we can use to reach it)
@@ -141,7 +142,12 @@ void TreeServer::SetID(const std::string &id)
if (iter == Utils->sidlist.end())
Utils->sidlist[sid] = this;
else
- throw CoreException("Server ID '"+id+"' already exists!");
+ DupError = true;
+}
+
+bool TreeServer::DuplicateID()
+{
+ return DupError;
}
int TreeServer::QuitUsers(const std::string &reason)
diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h
index 2a96012e3..d465722aa 100644
--- a/src/modules/m_spanningtree/treeserver.h
+++ b/src/modules/m_spanningtree/treeserver.h
@@ -44,6 +44,7 @@ class TreeServer : public classbase
bool LastPingWasGood; /* True if the server responded to the last PING with a PONG */
SpanningTreeUtilities* Utils; /* Utility class */
std::string sid; /* Server ID */
+ bool DupError; /* True if the server ID is duplicated (!) */
/** Set server ID
* @param id Server ID
@@ -192,6 +193,10 @@ class TreeServer : public classbase
*/
std::string& GetID();
+ /** True on duplicate server ID (server not usable)
+ */
+ bool DuplicateID();
+
/** Destructor
*/
~TreeServer();