From d1b146808e53494f42cd6c89f81a6106b7bde2c2 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 7 Feb 2010 03:36:55 +0000 Subject: [PATCH] More cleanup of quit servers git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12394 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.cpp | 7 +++++++ src/modules/m_spanningtree/treesocket2.cpp | 16 +++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 0c221a9f4..e744b675a 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -150,6 +150,13 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime) for (server_hash::iterator i = Utils->serverlist.begin(); i != Utils->serverlist.end(); i++) { TreeServer *s = i->second; + + if (s->GetSocket() && s->GetSocket()->GetLinkState() == DYING) + { + s->GetSocket()->SendError("Ping timeout"); + s->GetSocket()->Squit(s,"Ping timeout"); + s->GetSocket()->Close(); + } // Fix for bug #792, do not ping servers that are not connected yet! // Remote servers have Socket == NULL and local connected servers have diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index aacbbc25f..42921058c 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -462,19 +462,13 @@ std::string TreeSocket::GetName() void TreeSocket::OnTimeout() { - if (this->LinkState == CONNECTING) - { - ServerInstance->SNO->WriteGlobalSno('l', "CONNECT: Connection to \002%s\002 timed out.", myhost.c_str()); - } + ServerInstance->SNO->WriteGlobalSno('l', "CONNECT: Connection to \002%s\002 timed out.", myhost.c_str()); } void TreeSocket::Close() { this->BufferedSocket::Close(); - - // Test fix for big fuckup - if (this->LinkState != CONNECTED) - return; + SetError("Remote host closed connection"); // Connection closed. // If the connection is fully up (state CONNECTED) @@ -485,9 +479,9 @@ void TreeSocket::Close() quitserver = this->InboundServerName; } TreeServer* s = Utils->FindServer(quitserver); - if (s) + if (s && s->GetSocket() == this) { - Squit(s,"Remote host closed the connection"); + Squit(s,getError()); } if (!quitserver.empty()) @@ -496,6 +490,6 @@ void TreeSocket::Close() time_t server_uptime = ServerInstance->Time() - this->age; if (server_uptime) - ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str()); + ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str()); } } -- 2.39.5