summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-05-19 11:56:50 -0700
committerJosh Blum <josh@joshknows.com>2010-05-19 11:56:50 -0700
commitfd28cd7056867ec1ab81f7fb408c382e110ddaa1 (patch)
tree0b85f733d11990377830dffd66437a6b3f9893e3
parentdd3850559fcc4fd91d83c787b12b3428cca6e296 (diff)
downloaduhd-fd28cd7056867ec1ab81f7fb408c382e110ddaa1.tar.gz
uhd-fd28cd7056867ec1ab81f7fb408c382e110ddaa1.tar.bz2
uhd-fd28cd7056867ec1ab81f7fb408c382e110ddaa1.zip
break recv loop on timeout
-rw-r--r--host/lib/transport/vrt_packet_handler.hpp12
1 files changed, 7 insertions, 5 deletions
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<boost::uint8_t *>(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");