]> granicus.if.org Git - icinga2/commitdiff
cluster: Disconnect timed out endpoints.
authorGunnar Beutner <gunnar@beutner.name>
Tue, 3 Sep 2013 14:51:49 +0000 (16:51 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 3 Sep 2013 14:51:49 +0000 (16:51 +0200)
components/cluster/clustercomponent.cpp

index b4f9ac166e3bcb43e6c08726b9d6640708f3ec71..8cbb3b039a9e23647bafb6b46627a645929762b8 100644 (file)
@@ -410,6 +410,17 @@ void ClusterComponent::ClusterTimerHandler(void)
 
        RelayMessage(Endpoint::Ptr(), message, false);
 
+       /* check if we've recently seen heartbeat messages from our peers */
+       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
+               if (!endpoint->IsConnected() || endpoint->GetSeen() > Utility::GetTime() - 60)
+                       continue;
+
+               Stream::Ptr client = endpoint->GetClient();
+
+               if (client)
+                       client->Close();
+       }
+
        Array::Ptr peers = GetPeers();
 
        if (!peers)