From ea2b698dbad69cf5ae62c7cac3a7506d776b0dcd Mon Sep 17 00:00:00 2001 From: Johannes Schmitz <schmitz@ti.rwth-aachen.de> Date: Wed, 7 May 2014 17:59:01 +0200 Subject: zeromq: Fix doxygen and memcpy for vlen --- gr-zeromq/lib/pull_source_impl.cc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'gr-zeromq/lib/pull_source_impl.cc') diff --git a/gr-zeromq/lib/pull_source_impl.cc b/gr-zeromq/lib/pull_source_impl.cc index 9b9e50a38f..b29a056d84 100644 --- a/gr-zeromq/lib/pull_source_impl.cc +++ b/gr-zeromq/lib/pull_source_impl.cc @@ -41,7 +41,7 @@ namespace gr { : gr::sync_block("pull_source", gr::io_signature::make(0, 0, 0), gr::io_signature::make(1, 1, itemsize * vlen)), - d_itemsize(itemsize) + d_itemsize(itemsize), d_vlen(vlen) { d_timeout = timeout >= 0 ? (int)(timeout*1e6) : 0; d_context = new zmq::context_t(1); @@ -71,21 +71,22 @@ namespace gr { // If we got a reply, process if (items[0].revents & ZMQ_POLLIN) { - // Receive data - zmq::message_t msg; - d_socket->recv(&msg); + // Receive data + zmq::message_t msg; + std::cout << "pull before" << std::endl; + d_socket->recv(&msg); + std::cout << "pull after" << std::endl; + // Copy to ouput buffer and return + if (msg.size() >= d_itemsize*d_vlen*noutput_items) { + memcpy(out, (void *)msg.data(), d_itemsize*d_vlen*noutput_items); - // Copy to ouput buffer and return - if (msg.size() >= d_itemsize*noutput_items) { - memcpy(out, (void *)msg.data(), d_itemsize*noutput_items); + return noutput_items; + } + else { + memcpy(out, (void *)msg.data(), msg.size()); - return noutput_items; - } - else { - memcpy(out, (void *)msg.data(), msg.size()); - - return msg.size()/d_itemsize; - } + return msg.size()/(d_itemsize*d_vlen); + } } else { return 0; // FIXME: someday when the scheduler does all the poll/selects -- cgit v1.2.3