From: Gunnar Beutner Date: Wed, 11 Sep 2013 07:18:15 +0000 (+0200) Subject: cluster: Fix idle timeout. X-Git-Tag: v0.0.3~566 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7fcde9eca8bab00c163dec3b14087315ad58233e;p=icinga2 cluster: Fix idle timeout. --- diff --git a/components/cluster/clustercomponent.cpp b/components/cluster/clustercomponent.cpp index 9f2332a22..fc70b7fbc 100644 --- a/components/cluster/clustercomponent.cpp +++ b/components/cluster/clustercomponent.cpp @@ -435,6 +435,9 @@ void ClusterComponent::NewClientHandler(const Socket::Ptr& client, TlsRole role) { ObjectLock olock(this); + Stream::Ptr oldClient = endpoint->GetClient(); + if (oldClient) + oldClient->Close(); endpoint->SetClient(tlsStream); ReplayLog(endpoint, tlsStream); } @@ -455,13 +458,15 @@ void ClusterComponent::ClusterTimerHandler(void) /* check if we've recently seen heartbeat messages from our peers */ BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects()) { - if (!endpoint->IsConnected() || endpoint->GetSeen() > Utility::GetTime() - 60) + if (!endpoint->IsConnected() || endpoint->GetSeen() > Utility::GetTime() - 300) continue; Stream::Ptr client = endpoint->GetClient(); - if (client) + if (client) { + Log(LogWarning, "cluster", "Closing connection for endpoiint '" + endpoint->GetName() + "' due to inactivity."); client->Close(); + } } Array::Ptr peers = GetPeers(); diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp index 2d7417250..1c18a4694 100644 --- a/lib/base/tlsutility.cpp +++ b/lib/base/tlsutility.cpp @@ -35,8 +35,6 @@ static void InitializeOpenSSL(void) SSL_library_init(); SSL_load_error_strings(); - SSL_COMP_get_compression_methods(); - l_SSLInitialized = true; }