Commits

Anonymous committed 8a4d186

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.

Comments (0)

Files changed (3)

include/s_newconf.h

 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);

modules/m_svinfo.c

 #include "numeric.h"
 #include "send.h"
 #include "s_conf.h"
+#include "s_newconf.h"
 #include "logger.h"
 #include "msg.h"
 #include "parse.h"
 		     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;
 	}
 		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)
 {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.