Fix automatic outbound connections (again; hopefully for good).
[ircu2.10.12-pk.git] / ircd / ircd.c
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) {