@@ -15,6 +15,12 @@ using namespace icinga;
1515
1616REGISTER_APIFUNCTION (Heartbeat, event, &JsonRpcConnection::HeartbeatAPIHandler);
1717
18+ /* *
19+ * We still send a heartbeat without timeout here
20+ * to keep the m_Seen variable up to date. This is to keep the
21+ * cluster connection alive when there isn't much going on.
22+ */
23+
1824void JsonRpcConnection::HandleAndWriteHeartbeats (boost::asio::yield_context yc)
1925{
2026 boost::system::error_code ec;
@@ -27,41 +33,16 @@ void JsonRpcConnection::HandleAndWriteHeartbeats(boost::asio::yield_context yc)
2733 break ;
2834 }
2935
30- if (m_NextHeartbeat != 0 && m_NextHeartbeat < Utility::GetTime ()) {
31- {
32- Log logMsg (LogWarning, " JsonRpcConnection" );
33-
34- if (m_Endpoint) {
35- logMsg << " Client for endpoint '" << m_Endpoint->GetName () << " '" ;
36- } else {
37- logMsg << " Anonymous client" ;
38- }
39-
40- logMsg << " has requested heartbeat message but hasn't responded in time. Closing connection." ;
41- }
42-
43- Disconnect ();
44- break ;
45- }
46-
4736 SendMessageInternal (new Dictionary ({
4837 { " jsonrpc" , " 2.0" },
4938 { " method" , " event::Heartbeat" },
50- { " params" , new Dictionary ({
51- { " timeout" , 120 }
52- }) }
39+ { " params" , new Dictionary () }
5340 }));
5441 }
5542}
5643
5744Value JsonRpcConnection::HeartbeatAPIHandler (const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
5845{
59- Value vtimeout = params->Get (" timeout" );
60-
61- if (!vtimeout.IsEmpty ()) {
62- origin->FromClient ->m_NextHeartbeat = Utility::GetTime () + vtimeout;
63- }
64-
6546 return Empty;
6647}
6748
0 commit comments