From cae84e982713f570654b4f8849b57f6f53019b36 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 22 Jun 2012 13:40:09 +0200 Subject: [PATCH] Bugfixes. --- base/application.cpp | 2 +- components/delegation/delegationcomponent.cpp | 2 +- icinga/endpointmanager.cpp | 5 +++++ icinga/jsonrpcendpoint.cpp | 7 ------- icinga/jsonrpcendpoint.h | 1 - 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/base/application.cpp b/base/application.cpp index c4e48d8de..8ecf9348a 100644 --- a/base/application.cpp +++ b/base/application.cpp @@ -296,7 +296,7 @@ void Application::Log(LogSeverity severity, const string& facility, const string char timestamp[100]; // TODO: make this configurable - if (severity < LogInformation) + if (!IsDebugging() && severity < LogInformation) return; string severityStr; diff --git a/components/delegation/delegationcomponent.cpp b/components/delegation/delegationcomponent.cpp index bc37909b8..da2c50393 100644 --- a/components/delegation/delegationcomponent.cpp +++ b/components/delegation/delegationcomponent.cpp @@ -72,7 +72,7 @@ void DelegationComponent::AssignService(const Endpoint::Ptr& checker, const Serv void DelegationComponent::AssignServiceResponseHandler(Service& service, const Endpoint::Ptr& sender, bool timedOut) { /* ignore the message if it's not from the designated checker for this service */ - if (!sender || service.GetChecker() != sender->GetIdentity()) + if (sender && service.GetChecker() != sender->GetIdentity()) return; if (timedOut) { diff --git a/icinga/endpointmanager.cpp b/icinga/endpointmanager.cpp index 2f03990a4..b4d5c9123 100644 --- a/icinga/endpointmanager.cpp +++ b/icinga/endpointmanager.cpp @@ -227,6 +227,11 @@ void EndpointManager::SendAnycastMessage(Endpoint::Ptr sender, for (map::iterator i = m_Endpoints.begin(); i != m_Endpoints.end(); i++) { Endpoint::Ptr endpoint = i->second; + + /* don't forward messages between non-local endpoints */ + if (!sender->IsLocal() && !endpoint->IsLocal()) + continue; + if (endpoint->HasSubscription(method)) candidates.push_back(endpoint); } diff --git a/icinga/jsonrpcendpoint.cpp b/icinga/jsonrpcendpoint.cpp index 466ce3d8a..6aa1dbd6b 100644 --- a/icinga/jsonrpcendpoint.cpp +++ b/icinga/jsonrpcendpoint.cpp @@ -69,11 +69,6 @@ bool JsonRpcEndpoint::IsConnected(void) const void JsonRpcEndpoint::ProcessRequest(Endpoint::Ptr sender, const RequestMessage& message) { if (IsConnected()) { - string id; - if (message.GetID(&id)) - // TODO: remove calls after a certain timeout (and notify callers?) - m_PendingCalls[id] = sender; - m_Client->SendMessage(message); } else { // TODO: persist the event @@ -116,8 +111,6 @@ void JsonRpcEndpoint::ClientClosedHandler(void) { Application::Log(LogWarning, "jsonrpc", "Lost connection to endpoint: identity=" + GetIdentity()); - m_PendingCalls.clear(); - // TODO: _only_ clear non-persistent publications/subscriptions // unregister ourselves if no persistent publications/subscriptions are left (use a timer for that, once we have a TTL property for the topics) ClearSubscriptions(); diff --git a/icinga/jsonrpcendpoint.h b/icinga/jsonrpcendpoint.h index cc9f050c7..852dadf86 100644 --- a/icinga/jsonrpcendpoint.h +++ b/icinga/jsonrpcendpoint.h @@ -58,7 +58,6 @@ private: shared_ptr m_SSLContext; string m_Address; JsonRpcClient::Ptr m_Client; - map m_PendingCalls; void SetAddress(string address);