]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/utils.h
Allow multiple autoconnects in a single <autoconnect> tag, fix infinite failover
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / utils.h
index 1de6de076157dcf5994671f8f6c67d29c3ed614f..a80b60e46a005b2288e8993c1ea4d24292e5dcfc 100644 (file)
@@ -20,6 +20,7 @@
 class TreeServer;
 class TreeSocket;
 class Link;
+class Autoconnect;
 class ModuleSpanningTree;
 class SpanningTreeUtilities;
 
@@ -62,21 +63,6 @@ typedef std::map<TreeServer*,TreeServer*> TreeServerList;
  */
 typedef std::map<irc::string, Module*> hookmodules;
 
-/** The Autoconnect class might as well be a struct,
- * but this is C++ and we don't believe in structs (!).
- * It holds the entire information of one <autoconnect>
- * tag from the main config file. We maintain a list
- * of them, and populate the list on rehash/load.
- */
-class Autoconnect : public classbase
-{
- public:
-       unsigned long Period;
-       std::string Server;
-       time_t NextConnectTime;
-       std::string FailOver;
-};
-
 /** Contains helper functions and variables for this module,
  * and keeps them out of the global namespace
  */
@@ -135,10 +121,10 @@ class SpanningTreeUtilities : public classbase
        std::map<TreeSocket*, std::pair<std::string, int> > timeoutlist;
        /** Holds the data from the <link> tags in the conf
         */
-       std::vector<Link> LinkBlocks;
+       std::vector<reference<Link> > LinkBlocks;
        /** Holds the data from the <autoconnect> tags in the conf
         */
-       std::vector<Autoconnect> AutoconnectBlocks;
+       std::vector<reference<Autoconnect> > AutoconnectBlocks;
 
        /** List of module pointers which can provide I/O abstraction
         */
@@ -166,7 +152,7 @@ class SpanningTreeUtilities : public classbase
 
        /** Prepare for class destruction
         */
-       void cull();
+       bool cull();
 
        /** Destroy class and free listeners etc
         */
@@ -228,10 +214,6 @@ class SpanningTreeUtilities : public classbase
         */
        bool IsServer(const std::string &ServerName);
 
-       /** Attempt to connect to the failover link of link x
-        */
-       void DoFailOver(Autoconnect* x);
-
        /** Find a link tag from a server name
         */
        Link* FindLink(const std::string& name);