Fix automatic outbound connections (again; hopefully for good).
authorMichael Poole <mdpoole@troilus.org>
Tue, 4 Jan 2005 00:44:08 +0000 (00:44 +0000)
committerMichael Poole <mdpoole@troilus.org>
Tue, 4 Jan 2005 00:44:08 +0000 (00:44 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1294 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/ircd.c

index 1cdc2eb6021be80a4e964e895085bd09715a89f1..07410e6f861016740fb586f0b50ffad5318893d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2005-01-13  Michael Poole <mdpoole@troilus.org>
+2005-01-03  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/ircd.c (try_connections): Test Connect hold time before
+       updating it (spotted by Kev).
+
+2005-01-03  Michael Poole <mdpoole@troilus.org>
 
        * Makefile.in: Add ircd/test as a subdirectory.
 
index 754ecab1e4535937bcb1d82d6d0bcae04dfda3d0..363903ebdde8a37f30a4b5e9f8f18d85324795db 100644 (file)
@@ -248,6 +248,7 @@ static void try_connections(struct Event* ev) {
   time_t            next        = 0;
   struct ConnectionClass* cltmp;
   struct Jupe*      ajupe;
+  int hold;
 
   assert(ET_EXPIRE == ev_type(ev));
   assert(0 != ev_timer(ev));
@@ -269,17 +270,19 @@ static void try_connections(struct Event* ev) {
 
     /* Update the next time we can consider this entry. */
     cltmp = aconf->conn_class;
+    hold = aconf->hold > CurrentTime; /* before we update aconf->hold */
     aconf->hold = ConFreq(cltmp) ? CurrentTime + ConFreq(cltmp) : 0;
 
     /* Do not try to connect if its use is still on hold until future,
      * too many links in its connection class, it is already linked,
      * or if connect rules forbid a link now.
      */
-    if ((aconf->hold > CurrentTime)
+    if (hold
         || (Links(cltmp) >= MaxLinks(cltmp))
         || FindServer(aconf->name)
-        || conf_eval_crule(aconf->name, CRULE_MASK))
+        || conf_eval_crule(aconf->name, CRULE_MASK)) {
       continue;
+    }
 
     /* Ensure it is at the end of the list for future checks. */
     if (aconf->next) {