diff options
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 264ee1078..86d511a2a 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -335,6 +335,7 @@ void ModuleSpanningTree::AutoConnectServers(time_t curtime) 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; @@ -344,8 +345,16 @@ void ModuleSpanningTree::DoConnectTimeout(time_t curtime) 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) diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 0687aa06b..a89bd2574 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -151,7 +151,7 @@ void TreeSocket::OnError(BufferedSocketError e) Utils->Creator->RemoteMessage(NULL,"Connection failed: Error binding socket to address or port (%s)", strerror(errno)); break; case I_ERR_WRITE: - Utils->Creator->RemoteMessage(NULL,"Connection failed: I/O error on connection (%s)", strerror(errno)); + Utils->Creator->RemoteMessage(NULL,"Connection failed: I/O error on connection (%s)", errno ? strerror(errno) : "Connection closed unexpectedly"); break; case I_ERR_NOMOREFDS: Utils->Creator->RemoteMessage(NULL,"Connection failed: Operating system is out of file descriptors!"); |