diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2014-05-07 11:36:10 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2014-05-07 11:36:10 -0700 |
commit | a3127199b8a380ff8abeaa572da1e191a9b396ea (patch) | |
tree | 6397f72ad87513b5a94e0fccf0749b2e6f4a2320 /gr-zeromq/lib/pull_source_impl.cc | |
parent | ddb4c1d744b417e79cf2d263d6cd8db37c4dbcb2 (diff) | |
parent | a036dd2f3e74387316946fbac47282a9e7c1e87d (diff) |
Merge remote-tracking branch 'iohannez/vlen' into zeromq
Diffstat (limited to 'gr-zeromq/lib/pull_source_impl.cc')
-rw-r--r-- | gr-zeromq/lib/pull_source_impl.cc | 29 |
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 |