diff options
-rw-r--r-- | host/lib/transport/nirio/rpc/rpc_client.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/host/lib/transport/nirio/rpc/rpc_client.cpp b/host/lib/transport/nirio/rpc/rpc_client.cpp index 028327c2e..f8dc26b50 100644 --- a/host/lib/transport/nirio/rpc/rpc_client.cpp +++ b/host/lib/transport/nirio/rpc/rpc_client.cpp @@ -16,7 +16,6 @@ // #include <uhd/transport/nirio/rpc/rpc_client.hpp> -#include <uhd/exception.hpp> #include <boost/bind.hpp> #include <boost/version.hpp> #include <boost/format.hpp> @@ -175,16 +174,20 @@ void rpc_client::_handle_response_hdr(const boost::system::error_code& err, size if (!_exec_err && (transferred == expected)) { //Response header received. Verify that it is expected if (func_args_header_t::match_function(_request.header, _response.header)) { - UHD_ASSERT_THROW(_response.header.func_args_size); - _response.data.resize(_response.header.func_args_size); - - //Wait for response data - boost::asio::async_read(_socket, - boost::asio::buffer(&(*_response.data.begin()), _response.data.size()), - boost::bind(&rpc_client::_handle_response_data, this, - boost::asio::placeholders::error, - boost::asio::placeholders::bytes_transferred, - _response.data.size())); + if (_response.header.func_args_size) + { + _response.data.resize(_response.header.func_args_size); + + //Wait for response data + boost::asio::async_read(_socket, + boost::asio::buffer(&(*_response.data.begin()), _response.data.size()), + boost::bind(&rpc_client::_handle_response_data, this, + boost::asio::placeholders::error, + boost::asio::placeholders::bytes_transferred, + _response.data.size())); + } else { + _handle_response_data(err, 0, 0); + } } else { //Unexpected response. Ignore it. UHD_LOG << "rpc_client received garbage responses." << std::endl; |