Skip to content

Commit

Permalink
Suppress focal-specific warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Aug 6, 2020
1 parent d4420b8 commit 1e532e0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ ign_find_package(IgnProtobuf
# Find ZeroMQ
ign_find_package(ZeroMQ VERSION 4 REQUIRED PRIVATE)

if (CMAKE_SYSTEM_NAME MATCHES "Linux")
execute_process(COMMAND lsb_release -cs
OUTPUT_VARIABLE RELEASE_CODENAME
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)

# Set UBUNTU_FOCAL in config.hh to flag cppzmq workaround.
if (${RELEASE_CODENAME} STREQUAL "focal")
set(UBUNTU_FOCAL 1)
endif()

endif()

#--------------------------------------
# Find cppzmq
ign_find_package(CPPZMQ REQUIRED PRIVATE
Expand Down
6 changes: 6 additions & 0 deletions include/ignition/transport/Helpers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
#define IGN_ZMQ_POST_4_3_1
#endif

#if CPPZMQ_VERSION >= 40700
#ifndef UBUNTU_FOCAL
#define IGN_CPPZMQ_POST_4_7_0
#endif
#endif

namespace ignition
{
namespace transport
Expand Down
1 change: 1 addition & 0 deletions include/ignition/transport/config.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
#cmakedefine BUILD_TYPE_RELEASE 1

#cmakedefine HAVE_IFADDRS 1
#cmakedefine UBUNTU_FOCAL 1
2 changes: 1 addition & 1 deletion src/Node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ bool Node::Unsubscribe(const std::string &_topic)
if (!this->dataPtr->shared->localSubscribers
.HasSubscriber(fullyQualifiedTopic))
{
#if (CPPZMQ_VERSION >= 40700)
#ifdef IGN_CPPZMQ_POST_4_7_0
this->dataPtr->shared->dataPtr->subscriber->set(
zmq::sockopt::unsubscribe, fullyQualifiedTopic);
#else
Expand Down
16 changes: 8 additions & 8 deletions src/NodeShared.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ void NodeShared::OnNewConnection(const MessagePublisher &_pub)
this->dataPtr->subscriber->connect(addr.c_str());

// Add a new filter for the topic.
#if (CPPZMQ_VERSION >= 40700)
#ifdef IGN_CPPZMQ_POST_4_7_0
this->dataPtr->subscriber->set(zmq::sockopt::subscribe, topic);
#else
this->dataPtr->subscriber->setsockopt(ZMQ_SUBSCRIBE,
Expand Down Expand Up @@ -1263,7 +1263,7 @@ bool NodeShared::InitializeSockets()


int lingerVal = 0;
#if (CPPZMQ_VERSION >= 40700)
#ifdef IGN_CPPZMQ_POST_4_7_0
this->dataPtr->publisher->set(zmq::sockopt::linger, lingerVal);
#else
this->dataPtr->publisher->setsockopt(ZMQ_LINGER,
Expand Down Expand Up @@ -1301,7 +1301,7 @@ bool NodeShared::InitializeSockets()
<< std::endl;
}
}
#if (CPPZMQ_VERSION >= 40700)
#ifdef IGN_CPPZMQ_POST_4_7_0
this->dataPtr->subscriber->set(zmq::sockopt::rcvhwm, rcvQueueVal);
#else
this->dataPtr->subscriber->setsockopt(ZMQ_RCVHWM,
Expand Down Expand Up @@ -1339,7 +1339,7 @@ bool NodeShared::InitializeSockets()
<< std::endl;
}
}
#if (CPPZMQ_VERSION >= 40700)
#ifdef IGN_CPPZMQ_POST_4_7_0
this->dataPtr->publisher->set(zmq::sockopt::sndhwm, sndQueueVal);

this->dataPtr->publisher->bind(anyTcpEp.c_str());
Expand Down Expand Up @@ -1439,7 +1439,7 @@ int NodeShared::RcvHwm()
int rcvHwm;
try
{
#if (CPPZMQ_VERSION >= 40700)
#ifdef IGN_CPPZMQ_POST_4_7_0
rcvHwm = this->dataPtr->subscriber->get(zmq::sockopt::rcvhwm);
#else
size_t rcvHwmSize = sizeof(rcvHwm);
Expand All @@ -1460,7 +1460,7 @@ int NodeShared::SndHwm()
int sndHwm;
try
{
#if (CPPZMQ_VERSION >= 40700)
#ifdef IGN_CPPZMQ_POST_4_7_0
sndHwm = this->dataPtr->publisher->get(zmq::sockopt::sndhwm);
#else
size_t sndHwmSize = sizeof(sndHwm);
Expand Down Expand Up @@ -1561,7 +1561,7 @@ void NodeSharedPrivate::SecurityOnNewConnection()
// See issue #74
if (userPass(user, pass))
{
#if (CPPZMQ_VERSION >= 40700)
#ifdef IGN_CPPZMQ_POST_4_7_0
this->subscriber->set(zmq::sockopt::plain_username, user);
this->subscriber->set(zmq::sockopt::plain_password, pass);
#else
Expand All @@ -1586,7 +1586,7 @@ void NodeSharedPrivate::SecurityInit()
int asPlainSecurityServer = static_cast<int>(
ZmqPlainSecurityServerOptions::ZMQ_PLAIN_SECURITY_SERVER_ENABLED);

#if (CPPZMQ_VERSION >= 40700)
#ifdef IGN_CPPZMQ_POST_4_7_0
this->publisher->set(zmq::sockopt::plain_server, asPlainSecurityServer);
this->publisher->set(zmq::sockopt::zap_domain, kIgnAuthDomain);
#else
Expand Down

0 comments on commit 1e532e0

Please sign in to comment.