Improve performance for ApiListener::SyncRelayMessage

refs #11014
This commit is contained in:
Gunnar Beutner 2016-01-27 08:43:20 +01:00
parent 22c21ebd61
commit 9ae1f1abee
2 changed files with 4 additions and 5 deletions

View File

@ -642,13 +642,12 @@ void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin,
Zone::Ptr target_zone = endpoint->GetZone();
allZones.insert(target_zone);
/* only relay messages to zones which have access to the object */
if (!target_zone->CanAccessObject(secobj)) {
finishedLogZones.insert(target_zone);
if (!target_zone->CanAccessObject(secobj))
continue;
}
allZones.insert(target_zone);
/* don't relay messages to disconnected endpoints */
if (!endpoint->GetConnected()) {

View File

@ -63,7 +63,7 @@ bool Zone::CanAccessObject(const ConfigObject::Ptr& object)
{
Zone::Ptr object_zone;
if (dynamic_pointer_cast<Zone>(object))
if (object->GetReflectionType() == Zone::TypeInstance)
object_zone = static_pointer_cast<Zone>(object);
else
object_zone = static_pointer_cast<Zone>(object->GetZone());