Skip to content

Commit

Permalink
disable multicast group rem/add logic in local mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Nov 18, 2023
1 parent e1d3907 commit 714088a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ecal/core/src/readwrite/ecal_reader_udp_mc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ namespace eCAL
// LAYER
////////////////
CUDPReaderLayer::CUDPReaderLayer() :
started(false)
started(false),
local_mode(false)
{}

CUDPReaderLayer::~CUDPReaderLayer()
Expand All @@ -59,6 +60,9 @@ namespace eCAL

void CUDPReaderLayer::Initialize()
{
// set local mode
local_mode = !Config::IsNetworkEnabled();

// set network attributes
SReceiverAttr attr;
attr.address = UDP::GetPayloadAddress("");
Expand All @@ -78,6 +82,10 @@ namespace eCAL
thread.Start(0, std::bind(&CDataReaderUDP::Receive, &reader, &rcv));
started = true;
}

// we use udp broadcast in local mode
if (local_mode) return;

// add topic name based multicast address
const std::string mcast_address = UDP::GetPayloadAddress(topic_name_);
if (topic_name_mcast_map.find(mcast_address) == topic_name_mcast_map.end())
Expand All @@ -90,6 +98,9 @@ namespace eCAL

void CUDPReaderLayer::RemSubscription(const std::string& /*host_name_*/, const std::string& topic_name_, const std::string& /*topic_id_*/)
{
// we use udp broadcast in local mode
if (local_mode) return;

const std::string mcast_address = UDP::GetPayloadAddress(topic_name_);
if (topic_name_mcast_map.find(mcast_address) == topic_name_mcast_map.end())
{
Expand Down
1 change: 1 addition & 0 deletions ecal/core/src/readwrite/ecal_reader_udp_mc.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace eCAL

private:
bool started;
bool local_mode;
CUDPReceiver rcv;
CThread thread;
CDataReaderUDP reader;
Expand Down

0 comments on commit 714088a

Please sign in to comment.