mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 22:24:44 +02:00
Removed the broker setting.
This commit is contained in:
parent
3214c29363
commit
208e055651
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user