diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-22 16:40:02 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-22 16:40:02 +0000 |
commit | 29b51086b95c86f812ac35ed7d3333f060ba5a8c (patch) | |
tree | 89aa4084906075fac71ebfbafd627ae2f60732fa /src/modules/m_spanningtree | |
parent | 6dd148749fc9f141746ad26b5c6d606560f448ad (diff) |
Nuke TIMESYNC from orbit \o/
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8998 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 25 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 9 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/time.cpp | 28 | ||||
-rw-r--r-- | src/modules/m_spanningtree/timesynctimer.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_spanningtree/timesynctimer.h | 10 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.h | 10 | ||||
-rw-r--r-- | src/modules/m_spanningtree/whois.cpp | 2 |
11 files changed, 10 insertions, 103 deletions
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index dd288b821..0b6c4430a 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -68,7 +68,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p irc::tokenstream users((params.size() > 2) ? params[2] : ""); /* users from the user list */ bool apply_other_sides_modes = true; /* True if we are accepting the other side's modes */ Channel* chan = this->Instance->FindChan(channel); /* The channel we're sending joins to */ - time_t ourTS = chan ? chan->age : Instance->Time(true)+600; /* The TS of our side of the link */ + time_t ourTS = chan ? chan->age : Instance->Time()+600; /* The TS of our side of the link */ bool created = !chan; /* True if the channel doesnt exist here yet */ std::string item; /* One item in the list of nicks */ diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 119e98220..f72974381 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -42,14 +42,6 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) ServerInstance->AddCommand(command_rconnect); command_rsquit = new cmd_rsquit(ServerInstance, this, Utils); ServerInstance->AddCommand(command_rsquit); - if (Utils->EnableTimeSync) - { - SyncTimer = new TimeSyncTimer(ServerInstance, this); - ServerInstance->Timers->AddTimer(SyncTimer); - } - else - SyncTimer = NULL; - RefreshTimer = new CacheRefreshTimer(ServerInstance, Utils); ServerInstance->Timers->AddTimer(RefreshTimer); @@ -416,17 +408,6 @@ int ModuleSpanningTree::HandleConnect(const char* const* parameters, int pcnt, U return 1; } -void ModuleSpanningTree::BroadcastTimeSync() -{ - if (Utils->MasterTime) - { - std::deque<std::string> params; - params.push_back(ConvToStr(ServerInstance->Time(false))); - params.push_back("FORCE"); - Utils->DoOneToMany(ServerInstance->Config->GetSID(), "TIMESET", params); - } -} - void ModuleSpanningTree::OnGetServerDescription(const std::string &servername,std::string &description) { TreeServer* s = Utils->FindServer(servername); @@ -691,7 +672,7 @@ void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick) /** IMPORTANT: We don't update the TS if the oldnick is just a case change of the newnick! */ if (irc::string(user->nick) != assign(oldnick)) - user->age = ServerInstance->Time(true); + user->age = ServerInstance->Time(); params.push_back(ConvToStr(user->age)); Utils->DoOneToMany(user->uuid,"NICK",params); @@ -916,7 +897,7 @@ void ModuleSpanningTree::OnEvent(Event* event) return; (*params)[1] = ":" + (*params)[1]; params->insert(params->begin() + 1,ServerInstance->Config->ServerName); - params->insert(params->begin() + 1,ConvToStr(ServerInstance->Time(true))); + params->insert(params->begin() + 1,ConvToStr(ServerInstance->Time())); Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FTOPIC",*params); } else if (event->GetEventID() == "send_mode") @@ -1002,8 +983,6 @@ ModuleSpanningTree::~ModuleSpanningTree() { /* This will also free the listeners */ delete Utils; - if (SyncTimer) - ServerInstance->Timers->DelTimer(SyncTimer); ServerInstance->Timers->DelTimer(RefreshTimer); diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index e8c83221e..4002ad61e 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -33,7 +33,6 @@ const long ProtocolVersion = 1200; class cmd_rconnect; class cmd_rsquit; class SpanningTreeUtilities; -class TimeSyncTimer; class CacheRefreshTimer; class TreeServer; class Link; @@ -51,10 +50,6 @@ class ModuleSpanningTree : public Module SpanningTreeUtilities* Utils; public: - /** Timer for clock syncs - */ - TimeSyncTimer *SyncTimer; - CacheRefreshTimer *RefreshTimer; /** Constructor @@ -137,10 +132,6 @@ class ModuleSpanningTree : public Module */ int HandleConnect(const char* const* parameters, int pcnt, User* user); - /** Send out time sync to all servers - */ - void BroadcastTimeSync(); - /** Attempt to send a message to a user */ void RemoteMessage(User* user, const char* format, ...); diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 86d13e96f..062aed855 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -29,7 +29,7 @@ void TreeSocket::DoBurst(TreeServer* s) { std::string name = s->GetName(); - std::string burst = ":" + this->Instance->Config->GetSID() + " BURST " +ConvToStr(Instance->Time(true)); + std::string burst = ":" + this->Instance->Config->GetSID() + " BURST " +ConvToStr(Instance->Time()); std::string endburst = ":" + this->Instance->Config->GetSID() + " ENDBURST"; this->Instance->SNO->WriteToSnoMask('l',"Bursting to \2%s\2 (Authentication: %s).", name.c_str(), this->GetTheirChallenge().empty() ? "plaintext password" : "SHA256-HMAC challenge-response"); this->WriteLine(burst); diff --git a/src/modules/m_spanningtree/time.cpp b/src/modules/m_spanningtree/time.cpp index 415ccbbad..3bf1e67b1 100644 --- a/src/modules/m_spanningtree/time.cpp +++ b/src/modules/m_spanningtree/time.cpp @@ -30,32 +30,6 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ -bool TreeSocket::HandleSetTime(const std::string &prefix, std::deque<std::string> ¶ms) -{ - if (!params.size() || !Utils->EnableTimeSync) - return true; - - bool force = false; - - if ((params.size() == 2) && (params[1] == "FORCE")) - force = true; - - time_t them = atoi(params[0].c_str()); - time_t us = Instance->Time(false); - - time_t diff = them - us; - - Utils->DoOneToAllButSender(prefix, "TIMESET", params, prefix); - - if (force || (them != us)) - { - time_t old = Instance->SetTimeDelta(diff); - Instance->Log(DEBUG, "TS (diff %d) from %s applied (old delta was %d)", diff, prefix.c_str(), old); - } - - return true; -} - bool TreeSocket::Time(const std::string &prefix, std::deque<std::string> ¶ms) { // :source.server TIME remote.server sendernick @@ -68,7 +42,7 @@ bool TreeSocket::Time(const std::string &prefix, std::deque<std::string> ¶ms User* u = this->Instance->FindNick(params[1]); if (u) { - params.push_back(ConvToStr(Instance->Time(false))); + params.push_back(ConvToStr(Instance->Time())); params[0] = prefix; Utils->DoOneToOne(this->Instance->Config->GetSID(),"TIME",params,params[0]); } diff --git a/src/modules/m_spanningtree/timesynctimer.cpp b/src/modules/m_spanningtree/timesynctimer.cpp index 0f0021ddf..bea28f1e4 100644 --- a/src/modules/m_spanningtree/timesynctimer.cpp +++ b/src/modules/m_spanningtree/timesynctimer.cpp @@ -28,15 +28,6 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ -TimeSyncTimer::TimeSyncTimer(InspIRCd *Inst, ModuleSpanningTree *Mod) : Timer(600, Inst->Time(), true), Instance(Inst), Module(Mod) -{ -} - -void TimeSyncTimer::Tick(time_t TIME) -{ - Module->BroadcastTimeSync(); -} - CacheRefreshTimer::CacheRefreshTimer(InspIRCd *Inst, SpanningTreeUtilities *Util) : Timer(3600, Inst->Time(), true), Instance(Inst), Utils(Util) { } diff --git a/src/modules/m_spanningtree/timesynctimer.h b/src/modules/m_spanningtree/timesynctimer.h index 7964c98d9..3f97255b3 100644 --- a/src/modules/m_spanningtree/timesynctimer.h +++ b/src/modules/m_spanningtree/timesynctimer.h @@ -24,16 +24,6 @@ class InspIRCd; * Timer is only one-shot however, so at the end of each Tick() we simply * insert another of ourselves into the pending queue :) */ -class TimeSyncTimer : public Timer -{ - private: - InspIRCd *Instance; - ModuleSpanningTree *Module; - public: - TimeSyncTimer(InspIRCd *Instance, ModuleSpanningTree *Mod); - virtual void Tick(time_t TIME); -}; - class CacheRefreshTimer : public Timer { private: diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 2fc847b0c..76920d6e6 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -160,11 +160,10 @@ bool TreeSocket::ProcessLine(std::string &line) } else if (command == "BURST") { - if (params.size() && Utils->EnableTimeSync) + if (params.size()) { - bool we_have_delta = (Instance->Time(false) != Instance->Time(true)); time_t them = atoi(params[0].c_str()); - time_t delta = them - Instance->Time(false); + time_t delta = them - Instance->Time(); if ((delta < -600) || (delta > 600)) { Instance->SNO->WriteToSnoMask('l',"\2ERROR\2: Your clocks are out by %d seconds (this is more than five minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs(delta)); @@ -175,13 +174,6 @@ bool TreeSocket::ProcessLine(std::string &line) { Instance->SNO->WriteToSnoMask('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs(delta)); } - - if (!Utils->MasterTime && !we_have_delta) - { - this->Instance->SetTimeDelta(delta); - // Send this new timestamp to any other servers - Utils->DoOneToMany(Instance->Config->GetSID(), "TIMESET", params); - } } this->LinkState = CONNECTED; Link* lnk = Utils->FindLink(InboundServerName); @@ -283,7 +275,7 @@ bool TreeSocket::ProcessLine(std::string &line) * When there is activity on the socket, reset the ping counter so * that we're not wasting bandwidth pinging an active server. */ - route_back_again->SetNextPingTime(time(NULL) + Utils->PingFreq); + route_back_again->SetNextPingTime(Instance->Time() + Utils->PingFreq); route_back_again->SetPingFlag(); } else diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 3c7ee2cf0..fb4a81ba1 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -448,8 +448,6 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) FlatLinks = Conf->ReadFlag("options","flatlinks",0); HideULines = Conf->ReadFlag("options","hideulines",0); AnnounceTSChange = Conf->ReadFlag("options","announcets",0); - EnableTimeSync = Conf->ReadFlag("timesync","enable",0); - MasterTime = Conf->ReadFlag("timesync", "master", 0); ChallengeResponse = !Conf->ReadFlag("options", "disablehmac", 0); quiet_bursts = Conf->ReadFlag("options", "quietbursts", 0); PingWarnTime = Conf->ReadInteger("options", "pingwarning", 0, true); diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 3bbff7ea6..c824b75ed 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -61,9 +61,7 @@ class SpanningTreeUtilities /** Announce TS changes to channels on merge */ bool AnnounceTSChange; - /** Synchronize timestamps between servers - */ - bool EnableTimeSync; + /** Make snomasks +CQ quiet during bursts and splits */ bool quiet_bursts; @@ -93,12 +91,6 @@ class SpanningTreeUtilities */ std::vector<Link> LinkBlocks; - /** If this is true, this server is the master sync server for time - * synching - e.g. it is the server with its clock correct. It will - * send out the correct time at intervals. - */ - bool MasterTime; - /** List of module pointers which can provide I/O abstraction */ hookmodules hooks; diff --git a/src/modules/m_spanningtree/whois.cpp b/src/modules/m_spanningtree/whois.cpp index 155b0e838..4ee485503 100644 --- a/src/modules/m_spanningtree/whois.cpp +++ b/src/modules/m_spanningtree/whois.cpp @@ -46,7 +46,7 @@ bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> ¶m char signon[MAXBUF]; char idle[MAXBUF]; snprintf(signon, MAXBUF, "%lu", (unsigned long)x->signon); - snprintf(idle, MAXBUF, "%lu", (unsigned long)abs((x->idle_lastmsg) - Instance->Time(true))); + snprintf(idle, MAXBUF, "%lu", (unsigned long)abs((x->idle_lastmsg) - Instance->Time())); std::deque<std::string> par; par.push_back(prefix); par.push_back(signon); |