aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_spanningtree/main.cpp
diff options
context:
space:
mode:
authorGravatar peavey2008-09-19 02:00:04 +0000
committerGravatar peavey2008-09-19 02:00:04 +0000
commitb7a20454ce09b3e8f81ca76d86b45993e3be0a86 (patch)
tree1db9c2e920350b36610e098dd7fab54a24f7eaf8 /src/modules/m_spanningtree/main.cpp
parentReinvert order of insert/erase into user hash_map to avoid a lil crash :) (diff)
downloadinspircd++-b7a20454ce09b3e8f81ca76d86b45993e3be0a86.tar.gz
inspircd++-b7a20454ce09b3e8f81ca76d86b45993e3be0a86.tar.bz2
inspircd++-b7a20454ce09b3e8f81ca76d86b45993e3be0a86.zip
Implement timeout on outgoing server connections as per our docs <link:timeout>
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10558 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/main.cpp')
-rw-r--r--src/modules/m_spanningtree/main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index c14687804..264ee1078 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -333,6 +333,21 @@ void ModuleSpanningTree::AutoConnectServers(time_t curtime)
}
}
+void ModuleSpanningTree::DoConnectTimeout(time_t curtime)
+{
+ 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();
+ }
+ }
+}
+
int ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters, User* user)
{
// we've already checked if pcnt > 0, so this is safe
@@ -573,6 +588,7 @@ void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
{
AutoConnectServers(curtime);
DoPingChecks(curtime);
+ DoConnectTimeout(curtime);
}
void ModuleSpanningTree::OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)