Skip to content

Commit 9a366d9

Browse files
committedFeb 23, 2018
zeromq: remove call to pmt::intern when checking queue
The rep_msg_sink was checking the head_delete_nowait status with a freshly constructed pmt intern.
1 parent 8508461 commit 9a366d9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed
 

‎gr-zeromq/lib/rep_msg_sink_impl.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ namespace gr {
4242
: gr::block("rep_msg_sink",
4343
gr::io_signature::make(0, 0, 0),
4444
gr::io_signature::make(0, 0, 0)),
45-
d_timeout(timeout)
45+
d_timeout(timeout),
46+
d_port(pmt::mp("in"))
4647
{
4748
int major, minor, patch;
4849
zmq::version(&major, &minor, &patch);
@@ -58,7 +59,7 @@ namespace gr {
5859
d_socket->setsockopt(ZMQ_LINGER, &time, sizeof(time));
5960
d_socket->bind (address);
6061

61-
message_port_register_in(pmt::mp("in"));
62+
message_port_register_in(d_port);
6263
}
6364

6465
rep_msg_sink_impl::~rep_msg_sink_impl()
@@ -87,7 +88,7 @@ namespace gr {
8788
while(!d_finished) {
8889

8990
// while we have data, wait for query...
90-
while(!empty_p(pmt::mp("in"))) {
91+
while(!empty_p(d_port)) {
9192

9293
// wait for query...
9394
zmq::pollitem_t items[] = { { static_cast<void *>(*d_socket), 0, ZMQ_POLLIN, 0 } };
@@ -105,7 +106,7 @@ namespace gr {
105106
throw std::runtime_error("Request was not 1 msg for rep/req request!!");
106107

107108
// create message copy and send
108-
pmt::pmt_t msg = delete_head_nowait(pmt::mp("in"));
109+
pmt::pmt_t msg = delete_head_nowait(d_port);
109110
std::stringbuf sb("");
110111
pmt::serialize( msg, sb );
111112
std::string s = sb.str();

‎gr-zeromq/lib/rep_msg_sink_impl.h

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ namespace gr {
3838
boost::thread *d_thread;
3939
bool d_finished;
4040

41+
const pmt::pmt_t d_port;
42+
4143
void readloop();
4244

4345
public:

0 commit comments

Comments
 (0)
Please sign in to comment.