From 1f74139ab4667b1dd71dd35d40097caa447069fa Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 3 Sep 2013 16:51:49 +0200 Subject: [PATCH] cluster: Disconnect timed out endpoints. --- components/cluster/clustercomponent.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/cluster/clustercomponent.cpp b/components/cluster/clustercomponent.cpp index b4f9ac166..8cbb3b039 100644 --- a/components/cluster/clustercomponent.cpp +++ b/components/cluster/clustercomponent.cpp @@ -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()) { + if (!endpoint->IsConnected() || endpoint->GetSeen() > Utility::GetTime() - 60) + continue; + + Stream::Ptr client = endpoint->GetClient(); + + if (client) + client->Close(); + } + Array::Ptr peers = GetPeers(); if (!peers) -- 2.40.0