}
}
+void ModuleSpanningTree::DoConnectTimeout(time_t curtime)
+{
+ std::vector<Link*> failovers;
+ for (std::map<TreeSocket*, std::pair<std::string, int> >::iterator i = Utils->timeoutlist.begin(); i != Utils->timeoutlist.end(); i++)
+ {
+ TreeSocket* s = i->first;
+ std::pair<std::string, int> p = i->second;
+ if (curtime > s->age + p.second)
+ {
+ ServerInstance->SNO->WriteToSnoMask('l',"CONNECT: Error connecting \002%s\002 (timeout of %d seconds)",p.first.c_str(),p.second);
+ ServerInstance->SE->DelFd(s);
+ s->Close();
+ Link* MyLink = Utils->FindLink(p.first);
+ if (MyLink)
+ failovers.push_back(MyLink);
+ }
+ }
+ /* Trigger failover for each timed out socket */
+ for (std::vector<Link*>::const_iterator n = failovers.begin(); n != failovers.end(); ++n)
+ {
+ Utils->DoFailOver(*n);
+ }
+}
+
int ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters, User* user)
{
// we've already checked if pcnt > 0, so this is safe
{
AutoConnectServers(curtime);
DoPingChecks(curtime);
+ DoConnectTimeout(curtime);
}
void ModuleSpanningTree::OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
void ModuleSpanningTree::OnRemoteKill(User* source, User* dest, const std::string &reason, const std::string &operreason)
{
+ if (!IS_LOCAL(source)) return; // Only start routing if we're origin.
std::deque<std::string> params;
params.push_back(":"+reason);
Utils->DoOneToMany(dest->uuid,"OPERQUIT",params);