Add missing lock.

This commit is contained in:
Gunnar Beutner 2013-09-12 15:07:37 +02:00
parent 0c64ea7f88
commit 4e54a96880
1 changed files with 7 additions and 0 deletions

View File

@ -1139,6 +1139,7 @@ void ClusterComponent::CheckAuthorityHandler(const DynamicObject::Ptr& object, c
continue;
if (authorities) {
ObjectLock olock(authorities);
BOOST_FOREACH(const String& authority, authorities) {
if (Utility::Match(authority, endpoint->GetName())) {
match = true;
@ -1156,6 +1157,12 @@ void ClusterComponent::CheckAuthorityHandler(const DynamicObject::Ptr& object, c
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();
unsigned long hash = Utility::SDBM(key);
unsigned long index = hash % endpoints.size();