From fd28cd7056867ec1ab81f7fb408c382e110ddaa1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 19 May 2010 11:56:50 -0700 Subject: break recv loop on timeout --- host/lib/transport/vrt_packet_handler.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'host/lib') diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp index 5b73c82bf..ab1b7e16c 100644 --- a/host/lib/transport/vrt_packet_handler.hpp +++ b/host/lib/transport/vrt_packet_handler.hpp @@ -193,22 +193,24 @@ namespace vrt_packet_handler{ //////////////////////////////////////////////////////////////// case uhd::device::RECV_MODE_FULL_BUFF:{ //////////////////////////////////////////////////////////////// - size_t num_samps = 0; + size_t accum_num_samps = 0; uhd::rx_metadata_t tmp_md; - while(num_samps < total_num_samps){ - num_samps += _recv1( + while(accum_num_samps < total_num_samps){ + size_t num_samps = _recv1( state, boost::asio::buffer_cast(buff) + (num_samps*io_type.size), total_num_samps - num_samps, - (num_samps == 0)? metadata : tmp_md, //only the first metadata gets kept + (accum_num_samps == 0)? metadata : tmp_md, //only the first metadata gets kept io_type, otw_type, tick_rate, zc_iface, vrt_header_offset_words32, recv_cb ); + if (num_samps == 0) break; //had a recv timeout or error, break loop + accum_num_samps += num_samps; } - return total_num_samps; + return accum_num_samps; } default: throw std::runtime_error("unknown recv mode"); -- cgit v1.2.3