From: w00t Date: Fri, 31 Oct 2008 23:52:59 +0000 (+0000) Subject: Tidy up FJOIN processing somewhat - don't bother faking a TS to get modes accepted... X-Git-Tag: v2.0.23~2346 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=de8be466941204bf47c9ed821b2e5a0a79ae64f1;p=user%2Fhenk%2Fcode%2Finspircd.git Tidy up FJOIN processing somewhat - don't bother faking a TS to get modes accepted, just use a high technology of programming known as an "if statement". Also add generous debug to this via snomask +d, as it seems the occasional desync is occuring. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10772 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 0a8c8ca94..a245981e6 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -60,7 +60,6 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque &p irc::tokenstream users((params.size() > 3) ? params[params.size() - 1] : ""); /* users from the user list */ bool apply_other_sides_modes = true; /* True if we are accepting the other side's modes */ Channel* chan = this->ServerInstance->FindChan(channel); /* The channel we're sending joins to */ - time_t ourTS = chan ? chan->age : ServerInstance->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 */ @@ -77,30 +76,40 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque &p } if (created) - chan = new Channel(ServerInstance, channel, ourTS); - - /* If our TS is less than theirs, we dont accept their modes */ - if (ourTS < TS) - apply_other_sides_modes = false; - - /* Our TS greater than theirs, clear all our modes from the channel, accept theirs. */ - if (ourTS > TS) { - std::deque param_list; - if (Utils->AnnounceTSChange && chan) - chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name.c_str(), chan->name.c_str(), (unsigned long) ourTS, (unsigned long) TS); - ourTS = TS; - if (!created) + ServerInstance->SNO->WriteToSnoMask('d', "Creation FJOIN recieved for %s, timestamp: %lu", chan->name.c_str(), (unsigned long)TS); + chan = new Channel(ServerInstance, channel, TS); + } + else + { + time_t ourTS = chan->age; + + ServerInstance->SNO->WriteToSnoMask('d', "Merge FJOIN recieved for %s, ourTS: %lu, TS: %lu", chan->name.c_str(), (unsigned long)TS, (unsigned long)TS); + /* If our TS is less than theirs, we dont accept their modes */ + if (ourTS < TS) + { + ServerInstance->SNO->WriteToSnoMask('d', "NOT Applying modes from other side"); + apply_other_sides_modes = false; + } + else if (ourTS > TS) { + /* Our TS greater than theirs, clear all our modes from the channel, accept theirs. */ + ServerInstance->SNO->WriteToSnoMask('d', "Removing our modes, accepting remote"); + std::deque param_list; + if (Utils->AnnounceTSChange && chan) + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name.c_str(), chan->name.c_str(), (unsigned long) ourTS, (unsigned long) TS); + ourTS = TS; chan->age = TS; param_list.push_back(channel); this->RemoveStatus(ServerInstance->Config->GetSID(), param_list); } + // The silent case here is ourTS == TS, we don't need to remove modes here, just to merge them later on. } /* First up, apply their modes if they won the TS war */ if (apply_other_sides_modes) { + ServerInstance->SNO->WriteToSnoMask('d', "Applying remote modestring for %s", params[0]); unsigned int idx = 2; std::vector modelist;