From 507e9554d69df3e2cee60fe52b02dc160c6e1602 Mon Sep 17 00:00:00 2001 From: danieldg Date: Thu, 1 Oct 2009 22:42:13 +0000 Subject: Fix timeoutlist calling ConnectServer when not needed git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11792 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index a9fbff7c8..b0829cc1d 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -354,21 +354,26 @@ dupe_found:; void ModuleSpanningTree::DoConnectTimeout(time_t curtime) { std::vector failovers; - for (std::map >::iterator i = Utils->timeoutlist.begin(); i != Utils->timeoutlist.end(); i++) + std::map >::iterator i = Utils->timeoutlist.begin(); + while (i != Utils->timeoutlist.end()) { TreeSocket* s = i->first; std::pair p = i->second; + std::map >::iterator me = i; + i++; 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); if (s->myautoconnect) failovers.push_back(s->myautoconnect); + Utils->timeoutlist.erase(me); s->Close(); } } - for(unsigned int i=0; i < failovers.size(); i++) + for(unsigned int j=0; j < failovers.size(); j++) { - ConnectServer(failovers[i]); + if (failovers[j]->position >= 0) + ConnectServer(failovers[j]); } } -- cgit v1.2.3