summaryrefslogtreecommitdiff
path: root/gr-zeromq/lib/req_msg_source_impl.cc
diff options
context:
space:
mode:
authorMichael Dickens <michael.dickens@ettus.com>2019-05-26 14:36:53 -0400
committerMartin Braun <martin.braun@ettus.com>2019-06-15 17:20:15 -0700
commit82251fad9cf3314124d4a91e97a35f6b0f78e5bb (patch)
tree430fc2e0cd40b3d6d27def0293ea759bb0029e6b /gr-zeromq/lib/req_msg_source_impl.cc
parent6996d1b7ee20fb7611068906bb64886eb5b514ef (diff)
zeromq: fixes to allow building using CPPZMQ 4.3.1 as well as prior
CPPZMQ deprecated some prototypes of "recv" and "send" in some version prior to 4.3.1. The "recv" one will be removed in 4.3.1 and thus will generate an error since no valid prototype exists in the way "recv" is currently being call. This fix updates our usage of both calls to work with the "new" and "old" ways, depending on the CPPZMQ version. Move the CPPZMQ header inclusion and a macro determine which version to use into a common local header.
Diffstat (limited to 'gr-zeromq/lib/req_msg_source_impl.cc')
-rw-r--r--gr-zeromq/lib/req_msg_source_impl.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/gr-zeromq/lib/req_msg_source_impl.cc b/gr-zeromq/lib/req_msg_source_impl.cc
index 4cfd03f686..6c80a77f27 100644
--- a/gr-zeromq/lib/req_msg_source_impl.cc
+++ b/gr-zeromq/lib/req_msg_source_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013,2014 Free Software Foundation, Inc.
+ * Copyright 2013,2014,2019 Free Software Foundation, Inc.
*
* This file is part of GNU Radio.
*
@@ -99,7 +99,11 @@ namespace gr {
int nmsg = 1;
zmq::message_t request(sizeof(int));
memcpy((void *) request.data (), &nmsg, sizeof(int));
+#if USE_NEW_CPPZMQ_SEND_RECV
+ d_socket->send(request, zmq::send_flags::none);
+#else
d_socket->send(request);
+#endif
}
zmq::pollitem_t items[] = { { static_cast<void *>(*d_socket), 0, ZMQ_POLLIN, 0 } };
@@ -109,7 +113,11 @@ namespace gr {
if (items[0].revents & ZMQ_POLLIN) {
// Receive data
zmq::message_t msg;
+#if USE_NEW_CPPZMQ_SEND_RECV
+ d_socket->recv(msg);
+#else
d_socket->recv(&msg);
+#endif
std::string buf(static_cast<char*>(msg.data()), msg.size());
std::stringbuf sb(buf);