+2006-02-04 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/ircd.c (try_connections): Scan all Connect blocks for the
+ earliest hold time (suggested by Michael).
+
2006-02-04 Michael Poole <mdpoole@troilus.org>
* ircd/m_join.c (m_join): Remove #if 0 code and update comment.
static void try_connections(struct Event* ev) {
struct ConfItem* aconf;
struct ConfItem** pconf;
- time_t next = 0;
- struct ConnectionClass* cltmp;
+ time_t next;
struct Jupe* ajupe;
- int hold;
+ int hold;
+ int done;
assert(ET_EXPIRE == ev_type(ev));
assert(0 != ev_timer(ev));
Debug((DEBUG_NOTICE, "Connection check at : %s", myctime(CurrentTime)));
+ next = CurrentTime + feature_int(FEAT_CONNECTFREQUENCY);
+ done = 0;
+
for (aconf = GlobalConfList; aconf; aconf = aconf->next) {
/* Only consider server items with non-zero port and non-zero
* connect times that are not actively juped.
hold = aconf->hold > CurrentTime;
/* Update next possible connection check time. */
- if (hold && (next > aconf->hold || next == 0))
+ if (hold && next > aconf->hold)
next = aconf->hold;
- cltmp = aconf->conn_class;
-
/* Do not try to connect if its use is still on hold until future,
+ * we have already initiated a connection this try_connections(),
* too many links in its connection class, it is already linked,
* or if connect rules forbid a link now.
*/
- if (hold
- || (Links(cltmp) > MaxLinks(cltmp))
+ if (hold || done
+ || (ConfLinks(aconf) > ConfMaxLinks(aconf))
|| FindServer(aconf->name)
|| conf_eval_crule(aconf->name, CRULE_MASK))
continue;
aconf->name);
/* And stop looking for further candidates. */
- break;
+ done = 1;
}
- if (next == 0)
- next = CurrentTime + feature_int(FEAT_CONNECTFREQUENCY);
-
Debug((DEBUG_NOTICE, "Next connection check : %s", myctime(next)));
-
timer_add(&connect_timer, try_connections, 0, TT_ABSOLUTE, next);
}