Fix delegation bug.

This commit is contained in:
Gunnar Beutner 2013-09-12 15:12:19 +02:00
parent 4e54a96880
commit b510545d4d
1 changed files with 2 additions and 10 deletions

View File

@ -467,6 +467,8 @@ void ClusterComponent::ClusterTimerHandler(void)
message->Set("method", "cluster::HeartBeat"); message->Set("method", "cluster::HeartBeat");
message->Set("params", params); message->Set("params", params);
Endpoint::GetByName(GetIdentity())->SetFeatures(features);
RelayMessage(Endpoint::Ptr(), message, false); RelayMessage(Endpoint::Ptr(), message, false);
{ {
@ -1128,10 +1130,6 @@ void ClusterComponent::CheckAuthorityHandler(const DynamicObject::Ptr& object, c
Array::Ptr authorities = object->GetAuthorities(); Array::Ptr authorities = object->GetAuthorities();
std::vector<String> endpoints; std::vector<String> endpoints;
if ((type == "checker" && SupportsChecks()) ||
(type == "notification" && SupportsNotifications()))
endpoints.push_back(GetIdentity());
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) { BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
bool match = false; bool match = false;
@ -1157,12 +1155,6 @@ void ClusterComponent::CheckAuthorityHandler(const DynamicObject::Ptr& object, c
std::sort(endpoints.begin(), endpoints.end()); std::sort(endpoints.begin(), endpoints.end());
std::ostringstream msgbuf;
BOOST_FOREACH(const String& name, endpoints) {
msgbuf << name << ", ";
}
Log(LogDebug, "cluster", "Responsible for " + object->GetName() + ": " + msgbuf.str());
String key = object->GetType()->GetName() + "\t" + object->GetName(); String key = object->GetType()->GetName() + "\t" + object->GetName();
unsigned long hash = Utility::SDBM(key); unsigned long hash = Utility::SDBM(key);
unsigned long index = hash % endpoints.size(); unsigned long index = hash % endpoints.size();