Skip to content

Commit

Permalink
m_spanningtree Burst to a new server before introducing it to the res…
Browse files Browse the repository at this point in the history
…t of the network

Fixes issue #103 reported by @nenolod
  • Loading branch information
attilamolnar authored and Sir Poggles committed Jun 13, 2012
1 parent 0ca64d8 commit 451fe7b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
8 changes: 2 additions & 6 deletions src/modules/m_spanningtree/server.cpp
Expand Up @@ -163,15 +163,15 @@ bool TreeSocket::Outbound_Reply_Server(parameterlist &params)
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;
}

Expand Down Expand Up @@ -259,10 +259,6 @@ bool TreeSocket::Inbound_Server(parameterlist &params)
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;
}
Expand Down
12 changes: 8 additions & 4 deletions src/modules/m_spanningtree/treesocket1.cpp
Expand Up @@ -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);
Expand Down
13 changes: 10 additions & 3 deletions src/modules/m_spanningtree/treesocket2.cpp
Expand Up @@ -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")
{
Expand Down

0 comments on commit 451fe7b

Please sign in to comment.