Disable autoconnect for a server with excessive TS delta.

Note that in some cases (different TS delta settings,
heavy lag) it is possible only one of the servers
detects the problem and autoconnect may be left enabled.
The mechanism used for disabling is the same as
/quote set autoconn <server> 0; the A flag in /stats c
disappears and a rehash or /quote set autoconn can put
it back.
This commit is contained in:
Jilles Tjoelker 2009-02-05 23:43:07 +01:00
parent 71059b1f3b
commit 6b2cf989b6
3 changed files with 21 additions and 0 deletions

View File

@ -223,6 +223,7 @@ extern void attach_server_conf(struct Client *, struct server_conf *);
extern void detach_server_conf(struct Client *);
extern void set_server_conf_autoconn(struct Client *source_p, const char *name,
int newval);
extern void disable_server_conf_autoconn(const char *name);
extern struct ConfItem *find_xline(const char *, int);

View File

@ -31,6 +31,7 @@
#include "numeric.h"
#include "send.h"
#include "s_conf.h"
#include "s_newconf.h"
#include "logger.h"
#include "msg.h"
#include "parse.h"
@ -96,6 +97,7 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char
log_client_name(source_p, SHOW_IP), (long) rb_current_time(), (long) theirtime, deltat);
rb_snprintf(squitreason, sizeof squitreason, "Excessive TS delta (my TS=%ld, their TS=%ld, delta=%d)",
(long) rb_current_time(), (long) theirtime, deltat);
disable_server_conf_autoconn(source_p->name);
exit_client(source_p, source_p, source_p, squitreason);
return 0;
}

View File

@ -458,6 +458,24 @@ set_server_conf_autoconn(struct Client *source_p, const char *name, int newval)
sendto_one_notice(source_p, ":Can't find %s", name);
}
void
disable_server_conf_autoconn(const char *name)
{
struct server_conf *server_p;
server_p = find_server_conf(name);
if(server_p != NULL && server_p->flags & SERVER_AUTOCONN)
{
server_p->flags &= ~SERVER_AUTOCONN;
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Disabling AUTOCONN for %s because of error",
name);
ilog(L_SERVER, "Disabling AUTOCONN for %s because of error",
name);
}
}
struct ConfItem *
find_xline(const char *gecos, int counter)
{