mirror of https://github.com/Icinga/icinga2.git
parent
8682c530af
commit
44114232d3
|
@ -65,7 +65,7 @@ void ApiClient::HeartbeatTimerHandler(void)
|
|||
request->Set("method", "event::Heartbeat");
|
||||
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("timeout", 30);
|
||||
params->Set("timeout", 120);
|
||||
|
||||
request->Set("params", params);
|
||||
|
||||
|
@ -78,8 +78,10 @@ Value ApiClient::HeartbeatAPIHandler(const MessageOrigin& origin, const Dictiona
|
|||
{
|
||||
Value vtimeout = params->Get("timeout");
|
||||
|
||||
if (!vtimeout.IsEmpty())
|
||||
if (!vtimeout.IsEmpty()) {
|
||||
origin.FromClient->m_NextHeartbeat = Utility::GetTime() + vtimeout;
|
||||
origin.FromClient->m_HeartbeatTimeout = vtimeout;
|
||||
}
|
||||
|
||||
return Empty;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ static Timer::Ptr l_ApiClientTimeoutTimer;
|
|||
|
||||
ApiClient::ApiClient(const String& identity, bool authenticated, const TlsStream::Ptr& stream, ConnectionRole role)
|
||||
: m_Identity(identity), m_Authenticated(authenticated), m_Stream(stream), m_Role(role), m_Seen(Utility::GetTime()),
|
||||
m_NextHeartbeat(0), m_Context(false)
|
||||
m_NextHeartbeat(0), m_HeartbeatTimeout(0), m_Context(false)
|
||||
{
|
||||
boost::call_once(l_ApiClientOnceFlag, &ApiClient::StaticInitialize);
|
||||
|
||||
|
@ -136,6 +136,9 @@ bool ApiClient::ProcessMessage(void)
|
|||
|
||||
m_Seen = Utility::GetTime();
|
||||
|
||||
if (m_HeartbeatTimeout != 0)
|
||||
m_NextHeartbeat = Utility::GetTime() + m_HeartbeatTimeout;
|
||||
|
||||
if (m_Endpoint && message->Contains("ts")) {
|
||||
double ts = message->Get("ts");
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ private:
|
|||
ConnectionRole m_Role;
|
||||
double m_Seen;
|
||||
double m_NextHeartbeat;
|
||||
double m_HeartbeatTimeout;
|
||||
Timer::Ptr m_TimeoutTimer;
|
||||
|
||||
StreamReadContext m_Context;
|
||||
|
|
Loading…
Reference in New Issue