From cc639e876f326e958dace8438ae41b8cd9563780 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 8 Dec 2010 19:25:26 -0800 Subject: usrp-n: simplify ctrl response error so it cant throw, also increase timeout while we are at it --- host/lib/usrp/usrp2/usrp2_iface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 257c1daa9..ffbe8eedb 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -33,6 +33,8 @@ using namespace uhd; using namespace uhd::usrp; using namespace uhd::transport; +static const double CTRL_RECV_TIMEOUT = 1.0; + class usrp2_iface_impl : public usrp2_iface{ public: /*********************************************************************** @@ -247,7 +249,7 @@ public: boost::uint8_t usrp2_ctrl_data_in_mem[udp_simple::mtu]; //allocate max bytes for recv const usrp2_ctrl_data_t *ctrl_data_in = reinterpret_cast(usrp2_ctrl_data_in_mem); while(true){ - size_t len = _ctrl_transport->recv(boost::asio::buffer(usrp2_ctrl_data_in_mem)); + size_t len = _ctrl_transport->recv(boost::asio::buffer(usrp2_ctrl_data_in_mem), CTRL_RECV_TIMEOUT); if(len >= sizeof(boost::uint32_t) and ntohl(ctrl_data_in->proto_ver) != USRP2_FW_COMPAT_NUM){ throw std::runtime_error(str(boost::format( "Expected protocol compatibility number %d, but got %d:\n" @@ -260,7 +262,7 @@ public: if (len == 0) break; //timeout //didnt get seq or bad packet, continue looking... } - throw std::runtime_error(this->get_cname() + ": no control response"); + throw std::runtime_error("no control response"); } rev_type get_rev(void){ -- cgit v1.2.3