Fix an infinite loop in ircd.c and skip clone checking for 0.0.0.0 clients.
[ircu2.10.12-pk.git] / ircd / ircd.c
index 2ed022bcb3cde8cab777c9a53cb2a4b279289235..754ecab1e4535937bcb1d82d6d0bcae04dfda3d0 100644 (file)
@@ -267,20 +267,20 @@ static void try_connections(struct Event* ev) {
     if (next > aconf->hold || next == 0)
         next = aconf->hold;
 
-    /* Skip this entry 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.
-     */
+    /* Update the next time we can consider this entry. */
     cltmp = aconf->conn_class;
+    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)
         || (Links(cltmp) >= MaxLinks(cltmp))
         || FindServer(aconf->name)
         || conf_eval_crule(aconf->name, CRULE_MASK))
       continue;
 
-    /* We want to connect; update entry's hold time. */
-    aconf->hold = ConFreq(cltmp) ? CurrentTime + ConFreq(cltmp) : 0;
-
     /* Ensure it is at the end of the list for future checks. */
     if (aconf->next) {
       /* Find aconf's location in the list and splice it out. */