]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treesocket1.cpp
Keep multiple IOHookProvider references in class ListenSocket
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket1.cpp
index d2fec0118a005f33a884e3eb97a4a161523b2607..e1642a086041bb54bb9b0eb9d1e62c8287f40864 100644 (file)
 #include "treesocket.h"
 #include "commands.h"
 
-/** Because most of the I/O gubbins are encapsulated within
- * BufferedSocket, we just call the superclass constructor for
- * most of the action, and append a few of our own values
- * to it.
+/** Constructor for outgoing connections.
+ * Because most of the I/O gubbins are encapsulated within
+ * BufferedSocket, we just call DoConnect() for most of the action,
+ * 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)
@@ -50,9 +50,7 @@ TreeSocket::TreeSocket(Link* link, Autoconnect* myac, const std::string& ipaddr)
        SendCapabilities(1);
 }
 
-/** When a listening socket gives us a new file descriptor,
- * we must associate it with a socket without creating a new
- * connection. This constructor is used for this purpose.
+/** Constructor for incoming connections
  */
 TreeSocket::TreeSocket(int newfd, ListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server)
        : BufferedSocket(newfd)
@@ -62,18 +60,18 @@ TreeSocket::TreeSocket(int newfd, ListenSocket* via, irc::sockets::sockaddrs* cl
        capab = new CapabData;
        capab->capab_phase = 0;
 
-       if (via->iohookprov)
-               via->iohookprov->OnAccept(this, client, server);
+       for (ListenSocket::IOHookProvList::iterator i = via->iohookprovs.begin(); i != via->iohookprovs.end(); ++i)
+       {
+               ListenSocket::IOHookProvRef& iohookprovref = *i;
+               if (iohookprovref)
+                       iohookprovref->OnAccept(this, client, server);
+       }
+
        SendCapabilities(1);
 
        Utils->timeoutlist[this] = std::pair<std::string, int>(linkID, 30);
 }
 
-ServerState TreeSocket::GetLinkState()
-{
-       return this->LinkState;
-}
-
 void TreeSocket::CleanNegotiationInfo()
 {
        // connect is good, reset the autoconnect block (if used)
@@ -97,10 +95,10 @@ TreeSocket::~TreeSocket()
 }
 
 /** When an outbound connection finishes connecting, we receive
- * this event, and must send our SERVER string to the other
+ * this event, and must do CAPAB negotiation with the other
  * side. If the other side is happy, as outlined in the server
  * to server docs on the inspircd.org site, the other side
- * will then send back its own server string.
+ * will then send back its own SERVER string eventually.
  */
 void TreeSocket::OnConnected()
 {