summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-06-03 05:15:44 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-06-03 05:15:44 +0000
commit6d87e0eb72511b25693789fea6ce2658fd5fad7d (patch)
tree1c95d4661554143e1b76d8ae5ad554cb4c56b64d
parent1c89004245d014d2fb961ca6c850e7df72af7993 (diff)
Use pongs to determine when servers are done syncing in Unreal, fixes a problem with Unreals endburst system where we have clients introduced to us from a "synced" server when they really arent
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2995 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--include/services.h1
-rw-r--r--src/protocol.cpp8
-rw-r--r--src/protocol/unreal32.c36
3 files changed, 29 insertions, 16 deletions
diff --git a/include/services.h b/include/services.h
index b831243aa..3544350fc 100644
--- a/include/services.h
+++ b/include/services.h
@@ -1036,6 +1036,7 @@ class CoreExport IRCDProto
*/
virtual void SendQuit(const char *nick, const char *) MARK_DEPRECATED;
virtual void SendQuit(BotInfo *bi, const char *fmt, ...);
+ virtual void SendPing(const char *servname, const char *who);
virtual void SendPong(const char *servname, const char *who);
virtual void SendJoin(BotInfo *bi, const char *, time_t) = 0;
virtual void SendSQLineDel(const std::string &) = 0;
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 3afe44bd6..2188e86ba 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -176,6 +176,14 @@ void IRCDProto::SendQuit(BotInfo *bi, const char *fmt, ...)
SendQuitInternal(bi, buf);
}
+void IRCDProto::SendPing(const char *servname, const char *who)
+{
+ if (!servname)
+ send_cmd(ircd->ts6 ? TS6SID : Config.ServerName, "PING %s", who);
+ else
+ send_cmd(ircd->ts6 ? TS6SID : Config.ServerName, "PING %s %s", servname, who);
+}
+
/**
* Send a PONG reply to a received PING.
* servname should be left NULL to send a one param reply.
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index 55fe49dd4..f26eec067 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -594,6 +594,23 @@ int anope_event_ping(const char *source, int ac, const char **av)
return MOD_CONT;
}
+/** This is here because:
+ *
+ * If we had servers three servers, A, B & C linked like so: A<->B<->C
+ * If Anope is (linked to) A and B splits from A and then reconnects
+ * B introduces itself, introduces C, sends EOS for C, introduces Bs clients
+ * introduces Cs clients, sends EOS for B. This causes all of Cs clients to be introduced
+ * with their server "not syncing". We now send a PING immediatly when receiving a new server
+ * and then finish sync once we get a pong back from that server
+ */
+int anope_event_pong(const char *source, int ac, const char **av)
+{
+ Server *s = findserver(servlist, source);
+ if (s && !is_sync(s))
+ finish_sync(s, 0);
+ return MOD_CONT;
+}
+
/* netinfo
* argv[0] = max global count
* argv[1] = time of end sync
@@ -610,20 +627,6 @@ int anope_event_netinfo(const char *source, int ac, const char **av)
return MOD_CONT;
}
-int anope_event_eos(const char *source, int ac, const char **av)
-{
- Server *s;
- s = findserver(servlist, source);
- /* If we found a server with the given source, that one just
- * finished bursting. If there was no source, then our uplink
- * server finished bursting. -GD
- */
- if (!s && serv_uplink)
- s = serv_uplink;
- finish_sync(s, 1);
- return MOD_CONT;
-}
-
int anope_event_436(const char *source, int ac, const char **av)
{
if (ac < 1)
@@ -984,6 +987,7 @@ int anope_event_server(const char *source, int ac, const char **av)
} else {
do_server(source, av[0], av[1], av[2], "");
}
+ ircdproto->SendPing(Config.ServerName, av[0]);
return MOD_CONT;
}
@@ -1241,6 +1245,8 @@ void moduleAddIRCDMsgs() {
m = createMessage("D", anope_event_part); addCoreMessage(IRCD,m);
m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m);
m = createMessage("8", anope_event_ping); addCoreMessage(IRCD,m);
+ m = createMessage("PONG", anope_event_pong); addCoreMessage(IRCD,m);
+ m = createMessage("9", anope_event_pong); addCoreMessage(IRCD,m);
m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m);
m = createMessage("!", anope_event_privmsg); addCoreMessage(IRCD,m);
m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m);
@@ -1273,8 +1279,6 @@ void moduleAddIRCDMsgs() {
m = createMessage("AD", anope_event_setident); addCoreMessage(IRCD,m);
m = createMessage("SETNAME", anope_event_setname); addCoreMessage(IRCD,m);
m = createMessage("AE", anope_event_setname); addCoreMessage(IRCD,m);
- m = createMessage("EOS", anope_event_eos); addCoreMessage(IRCD,m);
- m = createMessage("ES", anope_event_eos); addCoreMessage(IRCD,m);
m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m);
m = createMessage("5", anope_event_error); addCoreMessage(IRCD,m);
m = createMessage("UMODE2", anope_event_umode2); addCoreMessage(IRCD,m);