Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7138] Bugfix/discovery server localhost #971

Merged
merged 10 commits into from
Jan 30, 2020
13 changes: 11 additions & 2 deletions include/fastrtps/rtps/builtin/BuiltinProtocols.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <list>

#include "../attributes/RTPSParticipantAttributes.h"

#include "../network/NetworkFactory.h"

namespace eprosima {

Expand Down Expand Up @@ -69,7 +69,16 @@ class BuiltinProtocols
* @param loclist LocatorList to update
* @return True on success
*/
bool updateMetatrafficLocators(LocatorList_t& loclist);
bool updateMetatrafficLocators(
LocatorList_t& loclist);

/**
* Traverses the list of discover servers translating from remote to local locators
* if possible
* @param nf NetworkFactory used to make the translation
*/
void transform_server_remote_locators(
NetworkFactory & nf);

//!BuiltinAttributes of the builtin protocols.
BuiltinAttributes m_att;
Expand Down
21 changes: 20 additions & 1 deletion src/cpp/rtps/builtin/BuiltinProtocols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ bool BuiltinProtocols::initBuiltinProtocols(
m_initialPeersList = m_att.initialPeersList;
m_DiscoveryServers = m_att.discovery_config.m_DiscoveryServers;

transform_server_remote_locators(p_part->network_factory());

const RTPSParticipantAllocationAttributes& allocation = p_part->getRTPSParticipantAttributes().allocation;

// PDP
Expand Down Expand Up @@ -137,12 +139,29 @@ bool BuiltinProtocols::initBuiltinProtocols(
return true;
}

bool BuiltinProtocols::updateMetatrafficLocators(LocatorList_t& loclist)
bool BuiltinProtocols::updateMetatrafficLocators(
LocatorList_t& loclist)
{
m_metatrafficUnicastLocatorList = loclist;
return true;
}

void BuiltinProtocols::transform_server_remote_locators(
NetworkFactory & nf)
{
for(RemoteServerAttributes & rs : m_DiscoveryServers)
{
for(Locator_t & loc : rs.metatrafficUnicastLocatorList)
{
Locator_t localized;
if(nf.transform_remote_locator(loc, localized))
{
loc = localized;
}
}
}
}

bool BuiltinProtocols::addLocalWriter(
RTPSWriter* w,
const fastrtps::TopicAttributes& topicAtt,
Expand Down
1 change: 1 addition & 0 deletions src/cpp/rtps/builtin/data/ParticipantProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
*/

#include <fastrtps/rtps/network/NetworkFactory.h>
#include <fastrtps/rtps/builtin/data/ParticipantProxyData.h>
#include <fastrtps/rtps/builtin/data/WriterProxyData.h>
#include <fastrtps/rtps/builtin/data/ReaderProxyData.h>
Expand Down
2 changes: 2 additions & 0 deletions src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,8 @@ bool PDPServer::match_servers_EDP_endpoints()

void PDPServer::announceParticipantState(bool new_change, bool dispose /* = false */, WriteParams& )
{
logInfo(RTPS_PDP, "Announcing RTPSParticipant State (new change: " << new_change << ")");

StatefulWriter * pW = dynamic_cast<StatefulWriter*>(mp_PDPWriter);
assert(pW);

Expand Down