summaryrefslogtreecommitdiff
path: root/gr-zeromq/lib/pull_source_impl.cc
diff options
context:
space:
mode:
authorJohannes Schmitz <schmitz@ti.rwth-aachen.de>2014-05-07 17:59:01 +0200
committerJohannes Schmitz <schmitz@ti.rwth-aachen.de>2014-05-07 17:59:01 +0200
commitea2b698dbad69cf5ae62c7cac3a7506d776b0dcd (patch)
treefb7f3d208433e75d4f18a3e13dc630e73af28869 /gr-zeromq/lib/pull_source_impl.cc
parent35aaec4d0d4b6f995911fd6d38697bc239cd68cf (diff)
zeromq: Fix doxygen and memcpy for vlen
Diffstat (limited to 'gr-zeromq/lib/pull_source_impl.cc')
-rw-r--r--gr-zeromq/lib/pull_source_impl.cc29
1 files changed, 15 insertions, 14 deletions
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