]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treesocket1.cpp
Fix build of m_spanningtree and display of dependency regeneration
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket1.cpp
index 12272d3b8e449ac5b4ad3087483591f5806b9c9b..e98246a3559de58c5b2fe03dfc2d1aa604ffc6e2 100644 (file)
 #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<std::string, int>(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<std::string, int>("<unknown>", 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();