Skip to content

Commit

Permalink
Fix deadlock in ReplicationComponent::EndpointConnectedHandler.
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarbeutner committed Apr 1, 2013
1 parent b3acd76 commit acfa3e6
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions components/replication/replicationcomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit acfa3e6

Please sign in to comment.