mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-10 00:03:14 +02:00
Link to servers faster after boot. Check links for re-linking more often. Allow connfreq of 5 seconds. Set default to 15. Get rid of HANGONGOODLINK/HANGONRETRYDELAY stuff.
This commit is contained in:
@@ -101,7 +101,7 @@ class opers
|
||||
class servers
|
||||
{
|
||||
pingfreq 60;
|
||||
connfreq 30; /* try to connect every 30 seconds */
|
||||
connfreq 15; /* try to connect every 15 seconds */
|
||||
maxclients 10; /* max servers */
|
||||
sendq 5M;
|
||||
};
|
||||
|
||||
@@ -421,18 +421,6 @@
|
||||
*/
|
||||
#define PINGFREQUENCY 120 /* Recommended value: 120 */
|
||||
|
||||
/*
|
||||
* Often net breaks for a short time and it's useful to try to
|
||||
* establishing the same connection again faster than CONNECTFREQUENCY
|
||||
* would allow. But, to keep trying on bad connection, we require
|
||||
* that connection has been open for certain minimum time
|
||||
* (HANGONGOODLINK) and we give the net few seconds to steady
|
||||
* (HANGONRETRYDELAY). This latter has to be long enough that the
|
||||
* other end of the connection has time to notice it broke too.
|
||||
*/
|
||||
#define HANGONRETRYDELAY 20 /* Recommended value: 20 seconds */
|
||||
#define HANGONGOODLINK 300 /* Recommended value: 5 minutes */
|
||||
|
||||
/*
|
||||
* Number of seconds to wait for write to complete if stuck.
|
||||
*/
|
||||
|
||||
+3
-3
@@ -1221,9 +1221,9 @@ struct _configitem_deny_dcc {
|
||||
};
|
||||
|
||||
struct _configitem_deny_link {
|
||||
ConfigItem *prev, *next;
|
||||
ConfigFlag_except flag;
|
||||
char *mask, *rule, *prettyrule;
|
||||
ConfigItem_deny_link *prev, *next;
|
||||
ConfigFlag_except flag;
|
||||
char *mask, *rule, *prettyrule;
|
||||
};
|
||||
|
||||
struct _configitem_deny_version {
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ void SetupEvents(void)
|
||||
EventAddEx(NULL, "check_pings", 1, 0, check_pings, NULL);
|
||||
EventAddEx(NULL, "check_deadsockets", 1, 0, check_deadsockets, NULL);
|
||||
EventAddEx(NULL, "check_unknowns", 16, 0, check_unknowns, NULL);
|
||||
EventAddEx(NULL, "try_connections", 10, 0, try_connections, NULL);
|
||||
EventAddEx(NULL, "try_connections", 2, 0, try_connections, NULL);
|
||||
|
||||
UnlockEventSystem();
|
||||
}
|
||||
|
||||
+22
-36
@@ -404,52 +404,38 @@ EVENT(try_connections)
|
||||
ConfigItem_deny_link *deny;
|
||||
aClient *cptr;
|
||||
int confrq;
|
||||
ConfigItem_class *cltmp;
|
||||
ConfigItem_class *class;
|
||||
|
||||
for (aconf = conf_link; aconf; aconf = (ConfigItem_link *) aconf->next) {
|
||||
/*
|
||||
* Also when already connecting! (update holdtimes) --SRB
|
||||
*/
|
||||
for (aconf = conf_link; aconf; aconf = (ConfigItem_link *) aconf->next)
|
||||
{
|
||||
/* We're only interested in autoconnect blocks that are valid (and ignore temporary link blocks) */
|
||||
if (!(aconf->outgoing.options & CONNECT_AUTO) || !aconf->outgoing.hostname || (aconf->flag.temporary == 1))
|
||||
continue;
|
||||
|
||||
cltmp = aconf->class;
|
||||
/*
|
||||
* ** Skip this entry if the use of it is still on hold until
|
||||
* ** future. Otherwise handle this entry (and set it on hold
|
||||
* ** until next time). Will reset only hold times, if already
|
||||
* ** made one successfull connection... [this algorithm is
|
||||
* ** a bit fuzzy... -- msa >;) ]
|
||||
*/
|
||||
|
||||
class = aconf->class;
|
||||
|
||||
/* Only do one connection attempt per <connfreq> seconds (for the same server) */
|
||||
if ((aconf->hold > TStime()))
|
||||
continue;
|
||||
|
||||
confrq = cltmp->connfreq;
|
||||
confrq = class->connfreq;
|
||||
aconf->hold = TStime() + confrq;
|
||||
/*
|
||||
* ** Found a CONNECT config with port specified, scan clients
|
||||
* ** and see if this server is already connected?
|
||||
*/
|
||||
cptr = find_name(aconf->servername, (aClient *)NULL);
|
||||
|
||||
if (!cptr && (cltmp->clients < cltmp->maxclients)) {
|
||||
/*
|
||||
* Check connect rules to see if we're allowed to try
|
||||
*/
|
||||
for (deny = conf_deny_link; deny;
|
||||
deny = (ConfigItem_deny_link *) deny->next)
|
||||
if (!match(deny->mask, aconf->servername)
|
||||
&& crule_eval(deny->rule))
|
||||
break;
|
||||
cptr = find_name(aconf->servername, NULL);
|
||||
if (cptr)
|
||||
continue; /* Server already connected (or connecting) */
|
||||
|
||||
if (!deny && connect_server(aconf, (aClient *)NULL,
|
||||
(struct hostent *)NULL) == 0)
|
||||
sendto_realops
|
||||
("Connection to %s[%s] activated.",
|
||||
aconf->servername, aconf->outgoing.hostname);
|
||||
if (class->clients >= class->maxclients)
|
||||
continue; /* Class is full */
|
||||
|
||||
/* Check connect rules to see if we're allowed to try the link */
|
||||
for (deny = conf_deny_link; deny; deny = deny->next)
|
||||
if (!match(deny->mask, aconf->servername) && crule_eval(deny->rule))
|
||||
break;
|
||||
|
||||
if (!deny && connect_server(aconf, NULL, NULL) == 0)
|
||||
sendto_realops("Connection to %s[%s] activated.",
|
||||
aconf->servername, aconf->outgoing.hostname);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-24
@@ -861,30 +861,6 @@ void close_connection(aClient *cptr)
|
||||
* remove outstanding DNS queries.
|
||||
*/
|
||||
unrealdns_delreq_bycptr(cptr);
|
||||
/*
|
||||
* If the connection has been up for a long amount of time, schedule
|
||||
* a 'quick' reconnect, else reset the next-connect cycle.
|
||||
*
|
||||
* Now just hold on a minute. We're currently doing this when a
|
||||
* CLIENT exits too? I don't think so! If its not a server, or
|
||||
* the SQUIT flag has been set, then we don't schedule a fast
|
||||
* reconnect. Pisses off too many opers. :-) -Cabal95
|
||||
*/
|
||||
if (IsServer(cptr) && !(cptr->flags & FLAGS_SQUIT) && cptr->serv->conf &&
|
||||
(!cptr->serv->conf->flag.temporary &&
|
||||
(cptr->serv->conf->options & CONNECT_AUTO)))
|
||||
{
|
||||
aconf = cptr->serv->conf;
|
||||
/*
|
||||
* Reschedule a faster reconnect, if this was a automaticly
|
||||
* connected configuration entry. (Note that if we have had
|
||||
* a rehash in between, the status has been changed to
|
||||
* CONF_ILLEGAL). But only do this if it was a "good" link.
|
||||
*/
|
||||
aconf->hold = TStime();
|
||||
aconf->hold += (aconf->hold - cptr->since > HANGONGOODLINK) ?
|
||||
HANGONRETRYDELAY : aconf->class->connfreq;
|
||||
}
|
||||
|
||||
if (cptr->authfd >= 0)
|
||||
{
|
||||
|
||||
+3
-3
@@ -3952,7 +3952,7 @@ int _conf_class(ConfigFile *conf, ConfigEntry *ce)
|
||||
}
|
||||
safestrdup(class->name, ce->ce_vardata);
|
||||
|
||||
class->connfreq = 60; /* default */
|
||||
class->connfreq = 15; /* default */
|
||||
|
||||
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
|
||||
{
|
||||
@@ -4069,9 +4069,9 @@ int _test_class(ConfigFile *conf, ConfigEntry *ce)
|
||||
}
|
||||
has_connfreq = 1;
|
||||
l = atol(cep->ce_vardata);
|
||||
if ((l < 10) || (l > 604800))
|
||||
if ((l < 5) || (l > 604800))
|
||||
{
|
||||
config_error("%s:%i: class::connfreq with illegal value (must be >10 and <7d)",
|
||||
config_error("%s:%i: class::connfreq with illegal value (must be >5 and <7d)",
|
||||
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
|
||||
errors++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user