From 8eaa2dd2b44600899d406e3a635c123d3ea451c2 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 15 Aug 2013 11:46:32 -0700 Subject: 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. --- host/lib/usrp/usrp2/usrp2_impl.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'host/lib/usrp/usrp2/usrp2_impl.cpp') 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(USRP2_FW_COMPAT_NUM); ctrl_data_out.id = uhd::htonx(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 -- cgit v1.2.3