diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc index 4d95ba98a..bc4bf51e2 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc @@ -152,6 +152,9 @@ int rtl_tcp_signal_source_c::work (int noutput_items, { gr_complex *out = reinterpret_cast ( output_items[0] ); int i = 0; + if (io_service_.stopped ()) { + return -1; + } { boost::mutex::scoped_lock lock (mutex_); @@ -282,7 +285,7 @@ rtl_tcp_signal_source_c::handle_read (const boost::system::error_code &ec, std::cout << "Error during read: " << ec << std::endl; LOG (WARNING) << "Error during read: " << ec; boost::mutex::scoped_lock lock (mutex_); - buffer_.clear (); + io_service_.stop (); not_empty_.notify_one (); } else { diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h index c60b412ee..ca3a696d6 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h @@ -115,7 +115,7 @@ private: } inline bool not_empty ( ) const { - return unread_ > 0; + return unread_ > 0 && !io_service_.stopped (); } };