mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
parent
b960850ce3
commit
8f53835c11
@ -520,8 +520,19 @@ void ApiListener::ApiTimerHandler(void)
|
|||||||
lmessage->Set("method", "log::SetLogPosition");
|
lmessage->Set("method", "log::SetLogPosition");
|
||||||
lmessage->Set("params", lparams);
|
lmessage->Set("params", lparams);
|
||||||
|
|
||||||
BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients())
|
double maxTs = 0;
|
||||||
|
|
||||||
|
BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) {
|
||||||
|
if (client->GetTimestamp() > maxTs)
|
||||||
|
maxTs = client->GetTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) {
|
||||||
|
if (client->GetTimestamp() != maxTs)
|
||||||
|
client->Disconnect();
|
||||||
|
else
|
||||||
client->SendMessage(lmessage);
|
client->SendMessage(lmessage);
|
||||||
|
}
|
||||||
|
|
||||||
Log(LogNotice, "ApiListener")
|
Log(LogNotice, "ApiListener")
|
||||||
<< "Setting log position for identity '" << endpoint->GetName() << "': "
|
<< "Setting log position for identity '" << endpoint->GetName() << "': "
|
||||||
@ -586,10 +597,21 @@ void ApiListener::SyncSendMessage(const Endpoint::Ptr& endpoint, const Dictionar
|
|||||||
Log(LogNotice, "ApiListener")
|
Log(LogNotice, "ApiListener")
|
||||||
<< "Sending message to '" << endpoint->GetName() << "'";
|
<< "Sending message to '" << endpoint->GetName() << "'";
|
||||||
|
|
||||||
BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients())
|
double maxTs = 0;
|
||||||
|
|
||||||
|
BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) {
|
||||||
|
if (client->GetTimestamp() > maxTs)
|
||||||
|
maxTs = client->GetTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) {
|
||||||
|
if (client->GetTimestamp() != maxTs)
|
||||||
|
continue;
|
||||||
|
|
||||||
client->SendMessage(message);
|
client->SendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin,
|
void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin,
|
||||||
|
@ -41,7 +41,7 @@ static Timer::Ptr l_JsonRpcConnectionTimeoutTimer;
|
|||||||
JsonRpcConnection::JsonRpcConnection(const String& identity, bool authenticated,
|
JsonRpcConnection::JsonRpcConnection(const String& identity, bool authenticated,
|
||||||
const TlsStream::Ptr& stream, ConnectionRole role)
|
const TlsStream::Ptr& stream, ConnectionRole role)
|
||||||
: m_Identity(identity), m_Authenticated(authenticated), m_Stream(stream),
|
: m_Identity(identity), m_Authenticated(authenticated), m_Stream(stream),
|
||||||
m_Role(role), m_Seen(Utility::GetTime()),
|
m_Role(role), m_Timestamp(Utility::GetTime()), m_Seen(Utility::GetTime()),
|
||||||
m_NextHeartbeat(0), m_HeartbeatTimeout(0)
|
m_NextHeartbeat(0), m_HeartbeatTimeout(0)
|
||||||
{
|
{
|
||||||
boost::call_once(l_JsonRpcConnectionOnceFlag, &JsonRpcConnection::StaticInitialize);
|
boost::call_once(l_JsonRpcConnectionOnceFlag, &JsonRpcConnection::StaticInitialize);
|
||||||
@ -66,6 +66,11 @@ void JsonRpcConnection::Start(void)
|
|||||||
DataAvailableHandler();
|
DataAvailableHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double JsonRpcConnection::GetTimestamp(void) const
|
||||||
|
{
|
||||||
|
return m_Timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
String JsonRpcConnection::GetIdentity(void) const
|
String JsonRpcConnection::GetIdentity(void) const
|
||||||
{
|
{
|
||||||
return m_Identity;
|
return m_Identity;
|
||||||
|
@ -57,6 +57,7 @@ public:
|
|||||||
|
|
||||||
void Start(void);
|
void Start(void);
|
||||||
|
|
||||||
|
double GetTimestamp(void) const;
|
||||||
String GetIdentity(void) const;
|
String GetIdentity(void) const;
|
||||||
bool IsAuthenticated(void) const;
|
bool IsAuthenticated(void) const;
|
||||||
Endpoint::Ptr GetEndpoint(void) const;
|
Endpoint::Ptr GetEndpoint(void) const;
|
||||||
@ -76,6 +77,7 @@ private:
|
|||||||
Endpoint::Ptr m_Endpoint;
|
Endpoint::Ptr m_Endpoint;
|
||||||
TlsStream::Ptr m_Stream;
|
TlsStream::Ptr m_Stream;
|
||||||
ConnectionRole m_Role;
|
ConnectionRole m_Role;
|
||||||
|
double m_Timestamp;
|
||||||
double m_Seen;
|
double m_Seen;
|
||||||
double m_NextHeartbeat;
|
double m_NextHeartbeat;
|
||||||
double m_HeartbeatTimeout;
|
double m_HeartbeatTimeout;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user