[icinga-checkins] icinga.org: icinga2/master: Fix deadlock in ReplicationComponent:: EndpointConnectedHandler.

git at icinga.org git at icinga.org
Mon Apr 1 17:21:58 CEST 2013


Module: icinga2
Branch: master
Commit: acfa3e6475ba22c4bf60028978acdf3bed098ea4
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=acfa3e6475ba22c4bf60028978acdf3bed098ea4

Author: Gunnar Beutner <gunnar at beutner.name>
Date:   Mon Apr  1 17:21:57 2013 +0200

Fix deadlock in ReplicationComponent::EndpointConnectedHandler.

---

 components/replication/replicationcomponent.cpp |   23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/components/replication/replicationcomponent.cpp b/components/replication/replicationcomponent.cpp
index 899cd5c..b8d2525 100644
--- a/components/replication/replicationcomponent.cpp
+++ b/components/replication/replicationcomponent.cpp
@@ -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;
 





More information about the icinga-checkins mailing list