From 317057b622acff5fdda450b42412f64152df5bc8 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 28 Apr 2006 19:38:29 +0000 Subject: Synching of channel TS after a whole channel has been sent. Please note that because a channels joins may consist of multiple FJOINs we cannot just sync the TS at the end of every FJOIN command otherwise we WILL get a desync. Instead, we send a command after the last FJOIN for a channel which tells the other servers it is now ok to sync that channels timestamp. (still to document: SYNCTS command in protocol docs) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3916 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index c36005fb2..97ed6754b 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1090,6 +1090,26 @@ class TreeSocket : public InspSocket return true; } + bool SyncChannelTS(std::string source, std::deque ¶ms) + { + if (params.size() == 2) + { + chanrec* c = Srv->FindChannel(params[0]); + if (c) + { + time_t theirTS = atoi(params[1].c_str()); + time_t ourTS = c->age; + if (ourTS >= theirTS) + { + log(DEBUG,"Updating timestamp for %s, our timestamp was %lu and theirs is %lu",c->name,ourTS,theirTS); + c->age = theirTS; + } + } + } + DoOneToMany(Srv->GetServerName(),"SYNCTS",params); + return true; + } + /* NICK command */ bool IntroduceClient(std::string source, std::deque ¶ms) { @@ -1250,6 +1270,7 @@ class TreeSocket : public InspSocket this->WriteLine(":"+Srv->GetServerName()+" FMODE "+c->name+" +h "+specific_halfop[y]->nick); } } + this->WriteLine(":"+Srv->GetServerName()+" SYNCTS "+c->name+" "+ConvToStr(c->age)); } /* Send G, Q, Z and E lines */ @@ -2374,6 +2395,10 @@ class TreeSocket : public InspSocket { return this->ForceJoin(prefix,params); } + else if (command == "SYNCTS") + { + return this->SyncChannelTS(prefix,params); + } else if (command == "SERVER") { return this->RemoteServer(prefix,params); -- cgit v1.2.3