Skip to content

Commit

Permalink
Merge pull request OpenDDS#4451 from jrw972/sedp-local-address
Browse files Browse the repository at this point in the history
`SedpLocalAddress` does not respect `DCPSDefaultAddress`
  • Loading branch information
jrw972 authored Jan 31, 2024
2 parents d1d2047 + 2e8a88a commit 3055313
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
11 changes: 4 additions & 7 deletions dds/DCPS/RTPS/RtpsDiscoveryConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ DCPS::NetworkAddress
RtpsDiscoveryConfig::sedp_local_address() const
{
return TheServiceParticipant->config_store()->get(config_key("SEDP_LOCAL_ADDRESS").c_str(),
DCPS::NetworkAddress::default_IPV4,
DCPS::ConfigStoreImpl::Format_Required_Port,
TheServiceParticipant->default_address(),
DCPS::ConfigStoreImpl::Format_Optional_Port,
DCPS::ConfigStoreImpl::Kind_IPV4);
}

Expand All @@ -332,7 +332,7 @@ RtpsDiscoveryConfig::sedp_local_address(const DCPS::NetworkAddress& mi)
{
TheServiceParticipant->config_store()->set(config_key("SEDP_LOCAL_ADDRESS").c_str(),
mi,
DCPS::ConfigStoreImpl::Format_Required_Port,
DCPS::ConfigStoreImpl::Format_Optional_Port,
DCPS::ConfigStoreImpl::Kind_IPV4);
}

Expand All @@ -357,11 +357,8 @@ RtpsDiscoveryConfig::sedp_advertised_local_address(const DCPS::NetworkAddress& m
DCPS::NetworkAddress
RtpsDiscoveryConfig::spdp_local_address() const
{
const DCPS::NetworkAddress d1(TheServiceParticipant->default_address());
const DCPS::NetworkAddress d2("0.0.0.0:0");

return TheServiceParticipant->config_store()->get(config_key("SPDP_LOCAL_ADDRESS").c_str(),
d1 ? d1 : d2,
TheServiceParticipant->default_address(),
DCPS::ConfigStoreImpl::Format_Optional_Port,
DCPS::ConfigStoreImpl::Kind_IPV4);
}
Expand Down
1 change: 1 addition & 0 deletions dds/DCPS/Service_Participant.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const String OPENDDS_COMMON_DCPS_CONFIG_FILE_default = "";
const char OPENDDS_COMMON_DCPS_DEBUG_LEVEL[] = "OPENDDS_COMMON_DCPS_DEBUG_LEVEL";

const char OPENDDS_COMMON_DCPS_DEFAULT_ADDRESS[] = "OPENDDS_COMMON_DCPS_DEFAULT_ADDRESS";
// Can't use NetworkAddress::default_IPV4 due to static initialization.
const NetworkAddress OPENDDS_COMMON_DCPS_DEFAULT_ADDRESS_default = NetworkAddress("0.0.0.0:0");

const char OPENDDS_COMMON_DCPS_DEFAULT_DISCOVERY[] = "OPENDDS_COMMON_DCPS_DEFAULT_DISCOVERY";
Expand Down

0 comments on commit 3055313

Please sign in to comment.