@@ -63,6 +63,7 @@ DiscoveryDataBase::~DiscoveryDataBase()
6363void DiscoveryDataBase::add_server (
6464 fastrtps::rtps::GuidPrefix_t server)
6565{
66+ std::lock_guard<std::recursive_mutex> guard (mutex_);
6667 EPROSIMA_LOG_INFO (DISCOVERY_DATABASE , " Server " << server << " added" );
6768 if (std::find (servers_.begin (), servers_.end (), server) == servers_.end ())
6869 {
@@ -73,6 +74,7 @@ void DiscoveryDataBase::add_server(
7374void DiscoveryDataBase::remove_server (
7475 fastrtps::rtps::GuidPrefix_t server)
7576{
77+ std::lock_guard<std::recursive_mutex> guard (mutex_);
7678 auto remove_it = std::find (servers_.begin (), servers_.end (), server);
7779 if (remove_it != servers_.end ())
7880 {
@@ -633,6 +635,7 @@ void DiscoveryDataBase::match_new_server_(
633635 {
634636 if (part.first == participant_prefix)
635637 {
638+ std::lock_guard<std::recursive_mutex> guard (mutex_);
636639 bool resend_new_pdp = false ;
637640 for (auto & server: servers_)
638641 {
@@ -2262,7 +2265,7 @@ std::map<eprosima::fastrtps::rtps::GUID_t, DiscoveryEndpointInfo>::iterator Disc
22622265 auto pit = participants_.find (it->first .guidPrefix );
22632266 if (pit == participants_.end ())
22642267 {
2265- EPROSIMA_LOG_ERROR (DISCOVERY_DATABASE , " Attempting to delete and orphan reader" );
2268+ EPROSIMA_LOG_ERROR (DISCOVERY_DATABASE , " Attempting to delete an orphan reader" );
22662269 // Returning error here could lead to an infinite loop
22672270 }
22682271 else
0 commit comments