From 9ae1f1abee28486d4c1c3e778fd90b5630a82036 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 27 Jan 2016 08:43:20 +0100 Subject: [PATCH] Improve performance for ApiListener::SyncRelayMessage refs #11014 --- lib/remote/apilistener.cpp | 7 +++---- lib/remote/zone.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 5f5961d12..92d42ac24 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -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()) { diff --git a/lib/remote/zone.cpp b/lib/remote/zone.cpp index 12b6b4b1f..311b11cca 100644 --- a/lib/remote/zone.cpp +++ b/lib/remote/zone.cpp @@ -63,7 +63,7 @@ bool Zone::CanAccessObject(const ConfigObject::Ptr& object) { Zone::Ptr object_zone; - if (dynamic_pointer_cast(object)) + if (object->GetReflectionType() == Zone::TypeInstance) object_zone = static_pointer_cast(object); else object_zone = static_pointer_cast(object->GetZone()); -- 2.40.0