aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-07-18 15:22:21 -0700
committerJosh Blum <josh@joshknows.com>2011-07-18 15:22:21 -0700
commit951ed3d66c343460450d2c3bc022298c1ccb2490 (patch)
tree3aa0635d1b269fadea629d2c9b08e3756d7a56c4
parent22319dfc30ce9c311c94a6d8fc747a9c2604cc03 (diff)
downloaduhd-951ed3d66c343460450d2c3bc022298c1ccb2490.tar.gz
uhd-951ed3d66c343460450d2c3bc022298c1ccb2490.tar.bz2
uhd-951ed3d66c343460450d2c3bc022298c1ccb2490.zip
usrp2: try/catch for socket open on discovery, use large send buffers windows
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 45db0d081..9a8269e6f 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -86,11 +86,17 @@ static device_addrs_t usrp2_find(const device_addr_t &hint_){
return usrp2_addrs;
}
- //create a udp transport to communicate
- std::string ctrl_port = boost::lexical_cast<std::string>(USRP2_UDP_CTRL_PORT);
- udp_simple::sptr udp_transport = udp_simple::make_broadcast(
- hint["addr"], ctrl_port
- );
+ //Create a UDP transport to communicate:
+ //Some devices will cause a throw when opened for a broadcast address.
+ //We print and recover so the caller can loop through all bcast addrs.
+ udp_simple::sptr udp_transport;
+ try{
+ udp_transport = udp_simple::make_broadcast(hint["addr"], BOOST_STRINGIZE(USRP2_UDP_CTRL_PORT));
+ }
+ catch(const std::exception &e){
+ UHD_MSG(error) << boost::format("Cannot open UDP transport on %s\n%s") % hint["addr"] % e.what() << std::endl;
+ return usrp2_addrs; //dont throw, but return empty address so caller can insert
+ }
//send a hello control packet
usrp2_ctrl_data_t ctrl_data_out = usrp2_ctrl_data_t();
@@ -277,6 +283,12 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
device_addr["recv_buff_size"] = "50e6";
#endif
}
+ if (not device_addr.has_key("send_buff_size")){
+ #if defined(UHD_PLATFORM_WIN32)
+ //a large send buff is ok to have on windows
+ device_addr["send_buff_size"] = "50e6";
+ #endif
+ }
device_addrs_t device_args = separate_device_addr(device_addr);