]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Disable autoconnect for a server with excessive TS delta.
authorJilles Tjoelker <redacted>
Thu, 5 Feb 2009 22:43:07 +0000 (23:43 +0100)
committerJilles Tjoelker <redacted>
Thu, 5 Feb 2009 22:43:07 +0000 (23:43 +0100)
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.

include/s_newconf.h
modules/m_svinfo.c
src/s_newconf.c

index 916cf77e3a1115f68d07989e81f355cf1f311c70..c0cc561d6ce7b28173605c54a03182ba7b9a401c 100644 (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);
index 3ffb8f488e543fe82ac1b5ac1fe0d0520bc844ce..1adc81da8000494286e3942b2ba41b6b445aac5a 100644 (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;
        }
index 93f5896849a6dee8f27ecc303c8b01f81f2275b6..b26be9de6b677fd1c0358d0d086356c801380456 100644 (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)
 {