]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treesocket1.cpp
Make kicknorejoin respect /INVITE (#1514).
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket1.cpp
index e1642a086041bb54bb9b0eb9d1e62c8287f40864..062d04222cd78bdd6a1e30fd04e99034b5ab170a 100644 (file)
@@ -24,7 +24,7 @@
 #include "iohook.h"
 
 #include "main.h"
-#include "modules/spanningtree.h"
+#include "modules/server.h"
 #include "utils.h"
 #include "treeserver.h"
 #include "link.h"
@@ -37,7 +37,7 @@
  * and only do minor initialization tasks ourselves.
  */
 TreeSocket::TreeSocket(Link* link, Autoconnect* myac, const std::string& ipaddr)
-       : linkID(assign(link->Name)), LinkState(CONNECTING), MyRoot(NULL), proto_version(0)
+       : linkID(link->Name), LinkState(CONNECTING), MyRoot(NULL), proto_version(0)
        , burstsent(false), age(ServerInstance->Time())
 {
        capab = new CapabData;
@@ -46,7 +46,7 @@ TreeSocket::TreeSocket(Link* link, Autoconnect* myac, const std::string& ipaddr)
        capab->capab_phase = 0;
 
        DoConnect(ipaddr, link->Port, link->Timeout, link->Bind);
-       Utils->timeoutlist[this] = std::pair<std::string, int>(linkID, link->Timeout);
+       Utils->timeoutlist[this] = std::pair<std::string, unsigned int>(linkID, link->Timeout);
        SendCapabilities(1);
 }
 
@@ -63,13 +63,21 @@ TreeSocket::TreeSocket(int newfd, ListenSocket* via, irc::sockets::sockaddrs* cl
        for (ListenSocket::IOHookProvList::iterator i = via->iohookprovs.begin(); i != via->iohookprovs.end(); ++i)
        {
                ListenSocket::IOHookProvRef& iohookprovref = *i;
-               if (iohookprovref)
-                       iohookprovref->OnAccept(this, client, server);
+               if (!iohookprovref)
+                       continue;
+
+               iohookprovref->OnAccept(this, client, server);
+               // IOHook could have encountered a fatal error, e.g. if the TLS ClientHello was already in the queue and there was no common TLS version
+               if (!getError().empty())
+               {
+                       TreeSocket::OnError(I_ERR_OTHER);
+                       return;
+               }
        }
 
        SendCapabilities(1);
 
-       Utils->timeoutlist[this] = std::pair<std::string, int>(linkID, 30);
+       Utils->timeoutlist[this] = std::pair<std::string, unsigned int>(linkID, 30);
 }
 
 void TreeSocket::CleanNegotiationInfo()
@@ -137,7 +145,7 @@ void TreeSocket::SendError(const std::string &errormessage)
        SetError(errormessage);
 }
 
-CmdResult CommandSQuit::HandleServer(TreeServer* server, std::vector<std::string>& params)
+CmdResult CommandSQuit::HandleServer(TreeServer* server, CommandBase::Params& params)
 {
        TreeServer* quitting = Utils->FindServer(params[0]);
        if (!quitting)