aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2/usrp2_impl.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-19 10:57:39 -0700
committerJosh Blum <josh@joshknows.com>2010-07-19 10:57:39 -0700
commitef9a395414acc203cc02e551e1790277cd0ef1f9 (patch)
tree1a6cc02ca18cb30bf1f4f253f3550743d7d43ea9 /host/lib/usrp/usrp2/usrp2_impl.cpp
parent8a7a824848f0a6276c0dc209bbd3ceeeb1eb7bd5 (diff)
downloaduhd-ef9a395414acc203cc02e551e1790277cd0ef1f9.tar.gz
uhd-ef9a395414acc203cc02e551e1790277cd0ef1f9.tar.bz2
uhd-ef9a395414acc203cc02e551e1790277cd0ef1f9.zip
usrp2: add a timeout to udp control and make it large for usrp2 control transactions
Diffstat (limited to 'host/lib/usrp/usrp2/usrp2_impl.cpp')
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 02f53bc69..2c314c085 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -35,6 +35,9 @@ using namespace uhd::usrp;
using namespace uhd::transport;
namespace asio = boost::asio;
+//! wait this long for a control response when discovering devices
+static const size_t DISCOVERY_TIMEOUT_MS = 100;
+
/***********************************************************************
* Helper Functions
**********************************************************************/
@@ -102,7 +105,7 @@ static uhd::device_addrs_t usrp2_find(const device_addr_t &hint){
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 = udp_transport->recv(asio::buffer(usrp2_ctrl_data_in_mem));
+ size_t len = udp_transport->recv(asio::buffer(usrp2_ctrl_data_in_mem), DISCOVERY_TIMEOUT_MS);
//std::cout << len << "\n";
if (len > offsetof(usrp2_ctrl_data_t, data)){
//handle the received data