X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Ftreesocket1.cpp;h=46f2657ff7fb7c71e715b6284a40c4ff68447a8b;hb=8cebe2878f3878afce6f643d93668155cb26801d;hp=b34335b010f0e59c031391624cd3896965e8795e;hpb=b6dbd6caab62bc2c0d11ce5a45d511611eb9c2ef;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index b34335b01..46f2657ff 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -16,17 +16,17 @@ #include "commands/cmd_stats.h" #include "socket.h" #include "xline.h" -#include "transport.h" -#include "m_hash.h" +#include "../transport.h" +#include "../m_hash.h" #include "socketengine.h" -#include "m_spanningtree/main.h" -#include "m_spanningtree/utils.h" -#include "m_spanningtree/treeserver.h" -#include "m_spanningtree/link.h" -#include "m_spanningtree/treesocket.h" -#include "m_spanningtree/resolvers.h" -#include "m_spanningtree/handshaketimer.h" +#include "main.h" +#include "utils.h" +#include "treeserver.h" +#include "link.h" +#include "treesocket.h" +#include "resolvers.h" +#include "handshaketimer.h" /* $ModDep: m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_hash.h m_spanningtree/handshaketimer.h */ @@ -46,6 +46,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string sh Utils->timeoutlist[this] = std::pair(ServerName, maxtime); if (Hook) BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); + hstimer = NULL; } /** When a listening socket gives us a new file descriptor, @@ -65,7 +66,8 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, int newfd, cha if (Hook) BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); - ServerInstance->Timers->AddTimer(new HandshakeTimer(ServerInstance, this, &(Utils->LinkBlocks[0]), this->Utils, 1)); + hstimer = new HandshakeTimer(ServerInstance, this, &(Utils->LinkBlocks[0]), this->Utils, 1); + ServerInstance->Timers->AddTimer(hstimer); /* Fix by Brain - inbound sockets need a timeout, too. 30 secs should be pleanty */ Utils->timeoutlist[this] = std::pair("", 30); @@ -81,10 +83,21 @@ Module* TreeSocket::GetHook() return this->Hook; } +void TreeSocket::CleanNegotiationInfo() +{ + ModuleList.clear(); + CapKeys.clear(); + ourchallenge.clear(); + theirchallenge.clear(); + OutboundPass.clear(); +} + TreeSocket::~TreeSocket() { if (Hook) BufferedSocketUnhookRequest(this, (Module*)Utils->Creator, Hook).Send(); + if (hstimer) + ServerInstance->Timers->DelTimer(hstimer); Utils->timeoutlist.erase(this); } @@ -115,7 +128,10 @@ bool TreeSocket::OnConnected() /* found who we're supposed to be connecting to, send the neccessary gubbins. */ if (this->GetHook()) - ServerInstance->Timers->AddTimer(new HandshakeTimer(ServerInstance, this, &(*x), this->Utils, 1)); + { + hstimer = new HandshakeTimer(ServerInstance, this, &(*x), this->Utils, 1); + ServerInstance->Timers->AddTimer(hstimer); + } else this->SendCapabilities(); @@ -215,7 +231,7 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) Event rmode((char*)Current->GetName().c_str(), (Module*)Utils->Creator, "lost_server"); rmode.Send(ServerInstance); - std::deque params; + parameterlist params; params.push_back(Current->GetName()); params.push_back(":"+reason); Utils->DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName()); @@ -259,6 +275,7 @@ bool TreeSocket::OnDataReady() if (data && *data) { this->in_buffer.append(data); + Utils->Creator->loopCall = true; /* While there is at least one new line in the buffer, * do something useful (we hope!) with it. */ @@ -280,6 +297,7 @@ bool TreeSocket::OnDataReady() return false; } } + Utils->Creator->loopCall = false; return true; } /* EAGAIN returns an empty but non-NULL string, so this