diff options
author | michael-west <michael.west@ettus.com> | 2015-07-29 16:55:38 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2015-08-05 13:07:16 -0700 |
commit | b08352f267730ea417ec345cd90833a6746a1114 (patch) | |
tree | e9f0c401c8dae070087e9989091449be8fbcf13a /host/lib/transport/udp_zero_copy.cpp | |
parent | bb62ab84fdad6f7cf18ea55d395dfbd7f11ed79d (diff) | |
download | uhd-b08352f267730ea417ec345cd90833a6746a1114.tar.gz uhd-b08352f267730ea417ec345cd90833a6746a1114.tar.bz2 uhd-b08352f267730ea417ec345cd90833a6746a1114.zip |
Fix for BUG 869: UHD: Unhandled exceptions during destruction of multi_usrp object cause application to terminate
- Prevented libusb_zero_copy_single from submitting transfers after libusb reports an error
- Made error messages in libusb_zero_copy and udp_zero_copy more descriptive
Diffstat (limited to 'host/lib/transport/udp_zero_copy.cpp')
-rw-r--r-- | host/lib/transport/udp_zero_copy.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index adc7d5585..70fb5b552 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -87,7 +87,10 @@ public: if (wait_for_recv_ready(_sock_fd, timeout)){ _len = ::recv(_sock_fd, (char *)_mem, _frame_size, 0); - UHD_ASSERT_THROW(_len > 0); // TODO: Handle case of recv error + if (_len == 0) + throw uhd::io_error("socket closed"); + if (_len < 0) + throw uhd::io_error(str(boost::format("recv error on socket: %s") % strerror(errno))); index++; //advances the caller's buffer return make(this, _mem, size_t(_len)); } @@ -126,6 +129,10 @@ public: boost::this_thread::sleep(boost::posix_time::microseconds(1)); continue; //try to send again } + if (ret == -1) + { + throw uhd::io_error(str(boost::format("send error on socket: %s") % strerror(errno))); + } UHD_ASSERT_THROW(ret == ssize_t(size())); } _claimer.release(); |