summaryrefslogtreecommitdiff
path: root/gr-zeromq/lib/pull_source_impl.cc
diff options
context:
space:
mode:
authorJohannes Schmitz <schmitz@ti.rwth-aachen.de>2014-05-09 16:24:21 +0200
committerJohannes Schmitz <schmitz@ti.rwth-aachen.de>2014-05-09 16:24:21 +0200
commit84444acb7a239626d11c4d06f7b6342c18180e0c (patch)
tree446ee6aa5bddbf3b14ff787eed386cba66d84a8a /gr-zeromq/lib/pull_source_impl.cc
parentb177145c4b80a67d2642638648b0a977e4c7025f (diff)
zeromq: Timeout needs to be in milliseconds for zmq 3.0, close sockets
correctly, cleanup
Diffstat (limited to 'gr-zeromq/lib/pull_source_impl.cc')
-rw-r--r--gr-zeromq/lib/pull_source_impl.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/gr-zeromq/lib/pull_source_impl.cc b/gr-zeromq/lib/pull_source_impl.cc
index 2498eeedc3..2ee6ad08c8 100644
--- a/gr-zeromq/lib/pull_source_impl.cc
+++ b/gr-zeromq/lib/pull_source_impl.cc
@@ -31,19 +31,18 @@ namespace gr {
namespace zeromq {
pull_source::sptr
- pull_source::make(size_t itemsize, size_t vlen, char *address, float timeout)
+ pull_source::make(size_t itemsize, size_t vlen, char *address, int timeout)
{
return gnuradio::get_initial_sptr
(new pull_source_impl(itemsize, vlen, address, timeout));
}
- pull_source_impl::pull_source_impl(size_t itemsize, size_t vlen, char *address, float timeout)
+ pull_source_impl::pull_source_impl(size_t itemsize, size_t vlen, char *address, int timeout)
: gr::sync_block("pull_source",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, itemsize * vlen)),
- d_itemsize(itemsize), d_vlen(vlen)
+ d_itemsize(itemsize), d_vlen(vlen), d_timeout(timeout)
{
- d_timeout = timeout >= 0 ? (int)(timeout*1e6) : 0;
d_context = new zmq::context_t(1);
d_socket = new zmq::socket_t(*d_context, ZMQ_PULL);
int time = 0;
@@ -56,6 +55,8 @@ namespace gr {
*/
pull_source_impl::~pull_source_impl()
{
+ d_socket->close();
+ d_context->close();
delete d_socket;
delete d_context;
}
@@ -89,7 +90,7 @@ namespace gr {
}
}
else {
- return 0; // FIXME: someday when the scheduler does all the poll/selects
+ return 0; // FIXME: someday when the scheduler does all the poll/selects
}
}