]> granicus.if.org Git - icinga2/commitdiff
Fix deadlock in ReplicationComponent::EndpointConnectedHandler.
authorGunnar Beutner <gunnar@beutner.name>
Mon, 1 Apr 2013 15:21:57 +0000 (17:21 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 1 Apr 2013 15:21:57 +0000 (17:21 +0200)
components/replication/replicationcomponent.cpp

index 899cd5cf52f3c780572efbe55d057ba86eb3879b..b8d2525930285e81edee9d5a2c90ec5a95b49d9d 100644 (file)
@@ -87,28 +87,19 @@ void ReplicationComponent::CheckResultRequestHandler(const RequestMessage& reque
 
 void ReplicationComponent::EndpointConnectedHandler(const Endpoint::Ptr& endpoint)
 {
-       {
-               ObjectLock olock(endpoint);
-
-               /* no need to sync the config with local endpoints */
-               if (endpoint->IsLocalEndpoint())
-                       return;
+       /* no need to sync the config with local endpoints */
+       if (endpoint->IsLocalEndpoint())
+               return;
 
-               /* we just assume the other endpoint wants object updates */
-               endpoint->RegisterSubscription("config::ObjectUpdate");
-               endpoint->RegisterSubscription("config::ObjectRemoved");
-       }
+       /* we just assume the other endpoint wants object updates */
+       endpoint->RegisterSubscription("config::ObjectUpdate");
+       endpoint->RegisterSubscription("config::ObjectRemoved");
 
        DynamicType::Ptr type;
        BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) {
                std::set<DynamicObject::Ptr> objects;
 
-               {
-                       ObjectLock olock(dt);
-                       objects = dt->GetObjects();
-               }
-
-               BOOST_FOREACH(const DynamicObject::Ptr& object, objects) {
+               BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) {
                        if (!ShouldReplicateObject(object))
                                continue;