diff options
author | Josh Blum <josh@joshknows.com> | 2010-06-04 12:23:20 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-06-04 12:23:20 -0700 |
commit | 89541d92664b98d8763492d4585eb2528df9e1f3 (patch) | |
tree | 595045121550ea9c6ab156936a93c4cdd4bd79c6 /host | |
parent | f2b560d5f8d19bf6bbd86802e03f061ecede78ec (diff) | |
download | uhd-89541d92664b98d8763492d4585eb2528df9e1f3.tar.gz uhd-89541d92664b98d8763492d4585eb2528df9e1f3.tar.bz2 uhd-89541d92664b98d8763492d4585eb2528df9e1f3.zip |
also use an mtu size recv buffer for the control packet recv
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index e43b9678e..e12c84d45 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -146,18 +146,19 @@ public: _ctrl_transport->send(boost::asio::buffer(&out_copy, sizeof(usrp2_ctrl_data_t))); //loop until we get the packet or 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 in_data; - size_t len = _ctrl_transport->recv(boost::asio::buffer(&in_data, sizeof(in_data))); - if(len >= sizeof(boost::uint32_t) and ntohl(in_data.proto_ver) != USRP2_PROTO_VERSION){ + size_t len = _ctrl_transport->recv(boost::asio::buffer(usrp2_ctrl_data_in_mem)); + if(len >= sizeof(boost::uint32_t) and ntohl(ctrl_data_in->proto_ver) != USRP2_PROTO_VERSION){ throw std::runtime_error(str( boost::format("Expected protocol version %d, but got %d\n" "The firmware build does not match the host code build." - ) % int(USRP2_PROTO_VERSION) % ntohl(in_data.proto_ver) + ) % int(USRP2_PROTO_VERSION) % ntohl(ctrl_data_in->proto_ver) )); } - if (len >= sizeof(usrp2_ctrl_data_t) and ntohl(in_data.seq) == _ctrl_seq_num){ - return in_data; + if (len >= sizeof(usrp2_ctrl_data_t) and ntohl(ctrl_data_in->seq) == _ctrl_seq_num){ + return *ctrl_data_in; } if (len == 0) break; //timeout //didnt get seq or bad packet, continue looking... |