diff options
author | Josh Blum <josh@joshknows.com> | 2013-08-15 11:46:32 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2013-08-15 15:21:35 -0700 |
commit | 8eaa2dd2b44600899d406e3a635c123d3ea451c2 (patch) | |
tree | 67208fdc579db9ba29c0106f289f469254b370eb /host/lib/usrp | |
parent | 8a77ed3a208aed4adabb1e1d7e2bff6d25c75db9 (diff) | |
download | uhd-8eaa2dd2b44600899d406e3a635c123d3ea451c2.tar.gz uhd-8eaa2dd2b44600899d406e3a635c123d3ea451c2.tar.bz2 uhd-8eaa2dd2b44600899d406e3a635c123d3ea451c2.zip |
usrp2: try/catch for first send of discovery routine
This send can fail with a network down/unreachable error.
The try/catch allows for discovery to continue.
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 21f166aa1..3afb3aac7 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -103,7 +103,18 @@ static device_addrs_t usrp2_find(const device_addr_t &hint_){ usrp2_ctrl_data_t ctrl_data_out = usrp2_ctrl_data_t(); ctrl_data_out.proto_ver = uhd::htonx<boost::uint32_t>(USRP2_FW_COMPAT_NUM); ctrl_data_out.id = uhd::htonx<boost::uint32_t>(USRP2_CTRL_ID_WAZZUP_BRO); - udp_transport->send(boost::asio::buffer(&ctrl_data_out, sizeof(ctrl_data_out))); + try + { + udp_transport->send(boost::asio::buffer(&ctrl_data_out, sizeof(ctrl_data_out))); + } + catch(const std::exception &ex) + { + UHD_MSG(error) << "USRP2 Network discovery error " << ex.what() << std::endl; + } + catch(...) + { + UHD_MSG(error) << "USRP2 Network discovery unknown error " << std::endl; + } //loop and recieve until the timeout boost::uint8_t usrp2_ctrl_data_in_mem[udp_simple::mtu]; //allocate max bytes for recv |