]> granicus.if.org Git - icinga2/commitdiff
Removed the broker setting.
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 10 May 2012 10:12:48 +0000 (12:12 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 10 May 2012 10:12:48 +0000 (12:12 +0200)
components/discovery/discoverycomponent.cpp
components/discovery/discoverycomponent.h

index ad5edfa6135555434452c6276d83acff91cd61b1..04d7a5b9a249012373a132dd501024b511a084fe 100644 (file)
@@ -42,17 +42,11 @@ void DiscoveryComponent::Start(void)
 {
        m_DiscoveryEndpoint = make_shared<VirtualEndpoint>();
 
-       long isBroker = 0;
-       GetConfig()->GetPropertyInteger("broker", &isBroker);
-       m_Broker = (isBroker != 0);
-
        m_DiscoveryEndpoint->RegisterMethodSource("discovery::RegisterComponent");
        m_DiscoveryEndpoint->RegisterMethodHandler("discovery::RegisterComponent",
                bind_weak(&DiscoveryComponent::RegisterComponentMessageHandler, shared_from_this()));
 
-       if (IsBroker())
-               m_DiscoveryEndpoint->RegisterMethodSource("discovery::NewComponent");
-
+       m_DiscoveryEndpoint->RegisterMethodSource("discovery::NewComponent");
        m_DiscoveryEndpoint->RegisterMethodHandler("discovery::NewComponent",
                bind_weak(&DiscoveryComponent::NewComponentMessageHandler, shared_from_this()));
 
@@ -216,18 +210,6 @@ bool DiscoveryComponent::GetComponentDiscoveryInfo(string component, ComponentDi
        return true;
 }
 
-/**
- * IsBroker
- *
- * Returns whether this component is a broker.
- *
- * @returns true if the component is a broker, false otherwise.
- */
-bool DiscoveryComponent::IsBroker(void) const
-{
-       return m_Broker;
-}
-
 /**
  * NewIdentityHandler
  *
@@ -263,19 +245,17 @@ int DiscoveryComponent::NewIdentityHandler(const EventArgs& ea)
 
        map<string, ComponentDiscoveryInfo::Ptr>::iterator ic;
 
-       if (IsBroker()) {
-               // we assume the other component _always_ wants
-               // discovery::NewComponent messages from us
-               endpoint->RegisterMethodSink("discovery::NewComponent");
+       // we assume the other component _always_ wants
+       // discovery::NewComponent messages from us
+       endpoint->RegisterMethodSink("discovery::NewComponent");
 
-               // send discovery::NewComponent message for ourselves
-               SendDiscoveryMessage("discovery::NewComponent", GetEndpointManager()->GetIdentity(), endpoint);
+       // send discovery::NewComponent message for ourselves
+       SendDiscoveryMessage("discovery::NewComponent", GetEndpointManager()->GetIdentity(), endpoint);
 
-               // send discovery::NewComponent messages for all components
-               // we know about
-               for (ic = m_Components.begin(); ic != m_Components.end(); ic++) {
-                       SendDiscoveryMessage("discovery::NewComponent", ic->first, endpoint);
-               }
+       // send discovery::NewComponent messages for all components
+       // we know about
+       for (ic = m_Components.begin(); ic != m_Components.end(); ic++) {
+               SendDiscoveryMessage("discovery::NewComponent", ic->first, endpoint);
        }
 
        // check if we already know the other component
@@ -500,12 +480,10 @@ void DiscoveryComponent::ProcessDiscoveryMessage(string identity, DiscoveryMessa
 
        m_Components[identity] = info;
 
-       if (IsBroker())
-               SendDiscoveryMessage("discovery::NewComponent", identity, Endpoint::Ptr());
+       SendDiscoveryMessage("discovery::NewComponent", identity, Endpoint::Ptr());
 
-       /* don't send a welcome message for discovery::RegisterComponent
-          messages unless we're a broker */
-       if (endpoint && (trusted || IsBroker()))
+       /* don't send a welcome message for discovery::RegisterComponent messages */
+       if (endpoint && trusted)
                FinishDiscoverySetup(endpoint);
 }
 
@@ -608,18 +586,16 @@ int DiscoveryComponent::DiscoveryTimerHandler(const TimerEventArgs& tea)
                        continue;
                }
 
-               if (IsBroker()) {
-                       /* send discovery message to all connected components to
-                          refresh their TTL for this component */
-                       SendDiscoveryMessage("discovery::NewComponent", identity, Endpoint::Ptr());
-               }
+               /* send discovery message to all connected components to
+                       refresh their TTL for this component */
+               SendDiscoveryMessage("discovery::NewComponent", identity, Endpoint::Ptr());
 
                Endpoint::Ptr endpoint = endpointManager->GetEndpointByIdentity(identity);
                if (endpoint && endpoint->IsConnected()) {
                        /* update LastSeen if we're still connected to this endpoint */
                        info->LastSeen = now;
                } else {
-                       /* TODO: figure out whether we actually want to connect to this component (_always_ if IsBroker() == true) */
+                       /* TODO: figure out whether we actually want to connect to this component */
                        /* try and reconnect to this component */
                        endpointManager->AddConnection(info->Node, info->Service);
                }
index 4164ca688b296d0d6b5a0c7ca8e4a2f191dbb1fd..df160a59ad6f38ce421f8e7f46f373c4745a8018 100644 (file)
@@ -43,7 +43,6 @@ class DiscoveryComponent : public IcingaComponent
 private:
        VirtualEndpoint::Ptr m_DiscoveryEndpoint;
        map<string, ComponentDiscoveryInfo::Ptr> m_Components;
-       bool m_Broker;
        Timer::Ptr m_DiscoveryTimer;
 
        int NewEndpointHandler(const NewEndpointEventArgs& neea);
@@ -66,8 +65,6 @@ private:
 
        int DiscoveryTimerHandler(const TimerEventArgs& tea);
 
-       bool IsBroker(void) const;
-
        void FinishDiscoverySetup(Endpoint::Ptr endpoint);
 
        int EndpointConfigHandler(const EventArgs& ea);