aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-06-04 12:00:23 -0700
committerJosh Blum <josh@joshknows.com>2010-06-04 12:00:23 -0700
commitdbc65d928362b983d8f6113319db87841a5b159d (patch)
tree84bf878d28f84e13e62dbbaa8a9e7b128a36758a
parentb2054a45d45ba85e30ff601159b18f5ebd15dd76 (diff)
downloaduhd-dbc65d928362b983d8f6113319db87841a5b159d.tar.gz
uhd-dbc65d928362b983d8f6113319db87841a5b159d.tar.bz2
uhd-dbc65d928362b983d8f6113319db87841a5b159d.zip
recv discovery packets with max size buffer (we dont know what to expect)
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index af3ec216a..1e6e02dd1 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -76,16 +76,17 @@ uhd::device_addrs_t usrp2::find(const device_addr_t &hint){
udp_transport->send(boost::asio::buffer(&ctrl_data_out, sizeof(ctrl_data_out)));
//loop and recieve until the timeout
+ boost::uint8_t usrp2_ctrl_data_in_mem[1500]; //allocate MTU bytes for recv
+ usrp2_ctrl_data_t *ctrl_data_in = reinterpret_cast<usrp2_ctrl_data_t *>(usrp2_ctrl_data_in_mem);
while(true){
- usrp2_ctrl_data_t ctrl_data_in;
- size_t len = udp_transport->recv(asio::buffer(&ctrl_data_in, sizeof(ctrl_data_in)));
+ size_t len = udp_transport->recv(asio::buffer(usrp2_ctrl_data_in_mem));
//std::cout << len << "\n";
if (len >= sizeof(usrp2_ctrl_data_t)){
//handle the received data
- switch(ntohl(ctrl_data_in.id)){
+ switch(ntohl(ctrl_data_in->id)){
case USRP2_CTRL_ID_WAZZUP_DUDE:
//make a boost asio ipv4 with the raw addr in host byte order
- boost::asio::ip::address_v4 ip_addr(ntohl(ctrl_data_in.data.ip_addr));
+ boost::asio::ip::address_v4 ip_addr(ntohl(ctrl_data_in->data.ip_addr));
device_addr_t new_addr;
new_addr["name"] = "USRP2";
new_addr["addr"] = ip_addr.to_string();