Skip to content

Commit

Permalink
Merge pull request OpenDDS#4241 from jrw972/multicast-transport-inst
Browse files Browse the repository at this point in the history
`MulticastInst` does not use `ConfigStore`
  • Loading branch information
jrw972 authored Sep 1, 2023
2 parents 8967e86 + 71b6811 commit b8525c5
Show file tree
Hide file tree
Showing 18 changed files with 444 additions and 205 deletions.
11 changes: 9 additions & 2 deletions dds/DCPS/ConfigStoreImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ ConfigStoreImpl::set(const char* key,

String
ConfigStoreImpl::get(const char* key,
const String& value) const
const String& value,
bool allow_empty) const
{
const ConfigPair cp(key, "");
String retval = value;
Expand All @@ -410,7 +411,7 @@ ConfigStoreImpl::get(const char* key,
for (size_t idx = 0; idx != samples.size(); ++idx) {
const ConfigPair& sample = samples[idx];
const DDS::SampleInfo& info = infos[idx];
if (info.valid_data) {
if (info.valid_data && (allow_empty || !sample.value().empty())) {
retval = sample.value();
}
}
Expand Down Expand Up @@ -502,6 +503,12 @@ namespace {
ConfigStoreImpl::NetworkAddressKind kind)
{
switch (kind) {
case ConfigStoreImpl::Kind_ANY:
return value.get_type() == AF_INET
#ifdef ACE_HAS_IPV6
|| value.get_type() == AF_INET6
#endif
;
case ConfigStoreImpl::Kind_IPV4:
return value.get_type() == AF_INET;
#ifdef ACE_HAS_IPV6
Expand Down
4 changes: 3 additions & 1 deletion dds/DCPS/ConfigStoreImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class OpenDDS_Dcps_Export ConfigStoreImpl : public ConfigStore {
};

enum NetworkAddressKind {
Kind_ANY,
Kind_IPV4
#ifdef ACE_HAS_IPV6
, Kind_IPV6
Expand Down Expand Up @@ -142,7 +143,8 @@ class OpenDDS_Dcps_Export ConfigStoreImpl : public ConfigStore {
void set(const char* key,
const String& value);
String get(const char* key,
const String& value) const;
const String& value,
bool allow_empty = true) const;

void set(const char* key,
const TimeDuration& value,
Expand Down
8 changes: 4 additions & 4 deletions dds/DCPS/transport/multicast/MulticastDataLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ MulticastDataLink::MulticastDataLink(const MulticastTransport_rch& transport,
// A send buffer may be bound to the send strategy to ensure a
// configured number of most-recent datagrams are retained:
if (session_factory_->requires_send_buffer()) {
const size_t nak_depth = config ? config->nak_depth_ : MulticastInst::DEFAULT_NAK_DEPTH;
const size_t nak_depth = config ? config->nak_depth() : MulticastInst::DEFAULT_NAK_DEPTH;
const size_t default_max_samples = DEFAULT_CONFIG_MAX_SAMPLES_PER_PACKET;
const size_t max_samples_per_packet = config ? config->max_samples_per_packet() : default_max_samples;
send_buffer_.reset(new SingleSendBuffer(nak_depth, max_samples_per_packet));
Expand All @@ -78,7 +78,7 @@ MulticastDataLink::join(const ACE_INET_Addr& group_address)
return false;
}

const std::string& net_if = cfg->local_address_;
const String net_if = cfg->local_address();
#ifdef ACE_HAS_MAC_OSX
socket_.opts(ACE_SOCK_Dgram_Mcast::OPT_BINDADDR_NO |
ACE_SOCK_Dgram_Mcast::DEFOPT_NULLIFACE);
Expand All @@ -95,15 +95,15 @@ MulticastDataLink::join(const ACE_INET_Addr& group_address)

ACE_HANDLE handle = this->socket_.get_handle();

if (!OpenDDS::DCPS::set_socket_multicast_ttl(this->socket_, cfg->ttl_)) {
if (!OpenDDS::DCPS::set_socket_multicast_ttl(this->socket_, cfg->ttl())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: ")
ACE_TEXT("MulticastDataLink::join: ")
ACE_TEXT("OpenDDS::DCPS::set_socket_multicast_ttl failed.\n")),
false);
}

int rcv_buffer_size = ACE_Utils::truncate_cast<int>(cfg->rcv_buffer_size_);
int rcv_buffer_size = ACE_Utils::truncate_cast<int>(cfg->rcv_buffer_size());
if (rcv_buffer_size != 0
&& ACE_OS::setsockopt(handle, SOL_SOCKET,
SO_RCVBUF,
Expand Down
Loading

0 comments on commit b8525c5

Please sign in to comment.