diff options
| author | Josh Blum <josh@joshknows.com> | 2010-12-08 19:25:26 -0800 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2010-12-08 19:25:51 -0800 | 
| commit | cc639e876f326e958dace8438ae41b8cd9563780 (patch) | |
| tree | e532ddbb5179eaffbc5906774c349262c6d42b4d | |
| parent | a51fb2ed133f5550265d32e49d601d6d90e0e277 (diff) | |
| download | uhd-cc639e876f326e958dace8438ae41b8cd9563780.tar.gz uhd-cc639e876f326e958dace8438ae41b8cd9563780.tar.bz2 uhd-cc639e876f326e958dace8438ae41b8cd9563780.zip  | |
usrp-n: simplify ctrl response error so it cant throw, also increase timeout while we are at it
| -rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 6 | 
1 files changed, 4 insertions, 2 deletions
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<const usrp2_ctrl_data_t *>(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){  | 
