]> granicus.if.org Git - icinga2/commitdiff
Improve performance for ApiListener::SyncRelayMessage
authorGunnar Beutner <gunnar@beutner.name>
Wed, 27 Jan 2016 07:43:20 +0000 (08:43 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Wed, 27 Jan 2016 07:43:20 +0000 (08:43 +0100)
refs #11014

lib/remote/apilistener.cpp
lib/remote/zone.cpp

index 5f5961d12e9cd50521ae71e6fff69ec7790c30c5..92d42ac24160ad05a64b67f9aca42f607b248f12 100644 (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()) {
index 12b6b4b1f9ceef3284d0b2032ad819b36ee05879..311b11ccac989cb3fe77e731e38a33676ab90c3b 100644 (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());