}
}
+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)