@@ -610,7 +610,8 @@ void DiscoveryDataBase::create_participant_from_change_(
610610}
611611
612612void DiscoveryDataBase::match_new_server_ (
613- eprosima::fastrtps::rtps::GuidPrefix_t& participant_prefix)
613+ eprosima::fastrtps::rtps::GuidPrefix_t& participant_prefix,
614+ bool is_superclient)
614615{
615616 // Send Our DATA(p) to the new participant.
616617 // If this is not done, our data could be skipped afterwards because of a gap sent in newer DATA(p)s,
@@ -619,40 +620,43 @@ void DiscoveryDataBase::match_new_server_(
619620 assert (our_data_it != participants_.end ());
620621 add_pdp_to_send_ (our_data_it->second .change ());
621622
622- // To obtain a mesh topology, we need to:
623- // - Make all known servers relevant to the new server
624- // - Make the new server relevant to all known servers
625- // - Send DATA(p) of all known servers to the new server
626- // - Send Data(p) of the new server to all other servers
627- for (auto & part : participants_)
623+ if (!is_superclient)
628624 {
629- if (part.first != server_guid_prefix_ && !part.second .is_client ())
625+ // To obtain a mesh topology with servers, we need to:
626+ // - Make all known servers relevant to the new server
627+ // - Make the new server relevant to all known servers
628+ // - Send DATA(p) of all known servers to the new server
629+ // - Send Data(p) of the new server to all other servers
630+ for (auto & part : participants_)
630631 {
631- if (part.first == participant_prefix )
632+ if (part.first != server_guid_prefix_ && !part. second . is_client () && !part. second . is_superclient () )
632633 {
633- bool resend_new_pdp = false ;
634- for (auto & server: servers_)
634+ if (part.first == participant_prefix)
635635 {
636- if (server != participant_prefix)
636+ bool resend_new_pdp = false ;
637+ for (auto & server: servers_)
638+ {
639+ if (server != participant_prefix)
640+ {
641+ // Make all known servers relevant to the new server, but not matched
642+ part.second .add_or_update_ack_participant (server, false );
643+ resend_new_pdp = true ;
644+ }
645+ }
646+ if (resend_new_pdp)
637647 {
638- // Make all known servers relevant to the new server, but not matched
639- part.second .add_or_update_ack_participant (server, false );
640- resend_new_pdp = true ;
648+ // Send DATA(p) of the new server to all other servers.
649+ add_pdp_to_send_ (part.second .change ());
641650 }
642651 }
643- if (resend_new_pdp)
652+ else
644653 {
645- // Send DATA(p) of the new server to all other servers.
654+ // Make the new server relevant to all known servers
655+ part.second .add_or_update_ack_participant (participant_prefix, false );
656+ // Send DATA(p) of all known servers to the new participant
646657 add_pdp_to_send_ (part.second .change ());
647658 }
648659 }
649- else
650- {
651- // Make the new server relevant to all known servers
652- part.second .add_or_update_ack_participant (participant_prefix, false );
653- // Send DATA(p) of all known servers to the new participant
654- add_pdp_to_send_ (part.second .change ());
655- }
656660 }
657661 }
658662 // The resources needed for TCP new connections are created during the matching process when the
@@ -768,7 +772,7 @@ void DiscoveryDataBase::create_new_participant_from_change_(
768772 !ret.first ->second .is_client () && ret.first ->second .is_local ())
769773 {
770774 // Match new server and create virtual endpoints
771- match_new_server_ (change_guid.guidPrefix );
775+ match_new_server_ (change_guid.guidPrefix , change_data. is_superclient () );
772776 }
773777 }
774778 else
@@ -795,7 +799,7 @@ void DiscoveryDataBase::update_participant_from_change_(
795799 // If it is local and server the only possibility is it was a remote server and it must be converted to local
796800 if (!change_data.is_client ())
797801 {
798- match_new_server_ (change_guid.guidPrefix );
802+ match_new_server_ (change_guid.guidPrefix , change_data. is_superclient () );
799803 }
800804
801805 // Update the change data
0 commit comments