summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-04-28 19:38:29 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-04-28 19:38:29 +0000
commit317057b622acff5fdda450b42412f64152df5bc8 (patch)
tree59a8701ea8efeca4e55725f336846b2c9ac34ba2 /src
parent20fa14b748fda469724bcd0c489955289d947691 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree.cpp25
1 files changed, 25 insertions, 0 deletions
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<std::string> &params)
+ {
+ 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<std::string> &params)
{
@@ -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);