diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-05-31 22:47:24 +0200 |
---|---|---|
committer | Sir Poggles <sir.pogsalot@gmail.com> | 2012-06-12 22:49:29 -0700 |
commit | 451fe7bc41d3260a6d4dac49c32c4575b4b5e28f (patch) | |
tree | fa79c004af2fdf099788fa1494c1cdb6bf14fc38 /src/modules/m_spanningtree | |
parent | 0ca64d8c137726f6d3547b75588e26d1f61ce464 (diff) |
m_spanningtree Burst to a new server before introducing it to the rest of the network
Fixes issue #103 reported by @nenolod
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/server.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 13 |
3 files changed, 20 insertions, 13 deletions
diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index 1b13fb2da..64c32e8fb 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -163,15 +163,15 @@ bool TreeSocket::Outbound_Reply_Server(parameterlist ¶ms) linkID = sname; MyRoot = new TreeServer(Utils, sname, description, sid, Utils->TreeRoot, this, x->Hidden); - Utils->TreeRoot->AddChild(MyRoot); + this->DoBurst(MyRoot); + params[4] = ":" + params[4]; /* IMPORTANT: Take password/hmac hash OUT of here before we broadcast the introduction! */ params[1] = "*"; Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",params,sname); - this->DoBurst(MyRoot); return true; } @@ -259,10 +259,6 @@ bool TreeSocket::Inbound_Server(parameterlist ¶ms) MyRoot = new TreeServer(Utils, sname, description, sid, Utils->TreeRoot, this, x->Hidden); Utils->TreeRoot->AddChild(MyRoot); - params[1] = "*"; - params[4] = ":" + params[4]; - Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",params,sname); - this->LinkState = WAIT_AUTH_2; return true; } diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 673b05c55..dcb35af31 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -183,10 +183,14 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) { DelServerEvent(Utils->Creator, Current->GetName()); - parameterlist params; - params.push_back(Current->GetName()); - params.push_back(":"+reason); - Utils->DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName()); + if (!Current->GetSocket() || Current->GetSocket()->GetLinkState() == CONNECTED) + { + parameterlist params; + params.push_back(Current->GetName()); + params.push_back(":"+reason); + Utils->DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName()); + } + if (Current->GetParent() == Utils->TreeRoot) { ServerInstance->SNO->WriteGlobalSno('l', "Server \002"+Current->GetName()+"\002 split: "+reason); diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 4582eb4c5..cb49d92c9 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -165,12 +165,19 @@ void TreeSocket::ProcessLine(std::string &line) } } this->LinkState = CONNECTED; - Utils->timeoutlist.erase(this); - parameterlist sparams; - Utils->DoOneToAllButSender(MyRoot->GetID(), "BURST", params, MyRoot->GetName()); + MyRoot->bursting = true; this->DoBurst(MyRoot); + + parameterlist sparams; + sparams.push_back(MyRoot->GetName()); + sparams.push_back("*"); + sparams.push_back("0"); + sparams.push_back(MyRoot->GetID()); + sparams.push_back(":" + MyRoot->GetDesc()); + Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(), "SERVER", sparams, MyRoot->GetName()); + Utils->DoOneToAllButSender(MyRoot->GetID(), "BURST", params, MyRoot->GetName()); } else if (command == "ERROR") { |