aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/CMakeLists.txt12
-rw-r--r--host/lib/transport/nirio/rpc/rpc_client.cpp36
2 files changed, 31 insertions, 17 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index 4ecdbd506..28ad6b968 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -154,15 +154,11 @@ IF(MSVC)
ENDIF(MSVC)
SET(Boost_ADDITIONAL_VERSIONS
- "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
- "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
- "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
- "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
- "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
- "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
- "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
+ "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" "1.45.0" "1.45"
+ "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.48.0" "1.49" "1.50.0" "1.50"
+ "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" "1.55.0" "1.55"
)
-FIND_PACKAGE(Boost 1.36 COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
+FIND_PACKAGE(Boost 1.41 COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
diff --git a/host/lib/transport/nirio/rpc/rpc_client.cpp b/host/lib/transport/nirio/rpc/rpc_client.cpp
index a5f8cf412..c16a844c1 100644
--- a/host/lib/transport/nirio/rpc/rpc_client.cpp
+++ b/host/lib/transport/nirio/rpc/rpc_client.cpp
@@ -17,7 +17,9 @@
#include <uhd/transport/nirio/rpc/rpc_client.hpp>
#include <boost/bind.hpp>
+#include <boost/version.hpp>
#include <boost/format.hpp>
+#include <boost/asio/error.hpp>
#define CHAIN_BLOCKING_XFER(func, exp, status) \
if (status) { \
@@ -48,7 +50,23 @@ rpc_client::rpc_client (
tcp::resolver resolver(_io_service);
tcp::resolver::query query(tcp::v4(), server, port);
tcp::resolver::iterator iterator = resolver.resolve(query);
- boost::asio::connect(_socket, iterator);
+
+ #if BOOST_VERSION < 104700
+ // default constructor creates end iterator
+ tcp::resolver::iterator end;
+
+ boost::system::error_code error = boost::asio::error::host_not_found;
+ while (error && iterator != end)
+ {
+ _socket.close();
+ _socket.connect(*iterator++, error);
+ }
+ if (error)
+ throw boost::system::system_error(error);
+ #else
+ boost::asio::connect(_socket, iterator);
+ #endif
+
UHD_LOG << "rpc_client connected to server." << std::endl;
try {
@@ -74,18 +92,18 @@ rpc_client::rpc_client (
_io_service_thread.reset(new boost::thread(boost::bind(&boost::asio::io_service::run, &_io_service)));
} else {
UHD_LOG << "rpc_client handshake failed." << std::endl;
- _exec_err.assign(boost::asio::error::connection_refused, boost::system::system_category());
+ _exec_err.assign(boost::asio::error::connection_refused, boost::asio::error::get_system_category());
}
UHD_LOG << boost::format("rpc_client archive = %d, rpc_server archive = %d\n.") %
_hshake_args_client.boost_archive_version %
_hshake_args_server.boost_archive_version;
} catch (boost::exception&) {
UHD_LOG << "rpc_client handshake aborted." << std::endl;
- _exec_err.assign(boost::asio::error::connection_refused, boost::system::system_category());
+ _exec_err.assign(boost::asio::error::connection_refused, boost::asio::error::get_system_category());
}
} catch (boost::exception&) {
UHD_LOG << "rpc_client connection request cancelled/aborted." << std::endl;
- _exec_err.assign(boost::asio::error::connection_aborted, boost::system::system_category());
+ _exec_err.assign(boost::asio::error::connection_aborted, boost::asio::error::get_system_category());
}
}
@@ -126,18 +144,18 @@ const boost::system::error_code& rpc_client::call(
if (status) {
if (!_exec_gate.timed_wait(lock, timeout)) {
UHD_LOG << "rpc_client function timed out." << std::endl;
- _exec_err.assign(boost::asio::error::timed_out, boost::system::system_category());
+ _exec_err.assign(boost::asio::error::timed_out, boost::asio::error::get_system_category());
}
} else {
UHD_LOG << "rpc_client connection dropped." << std::endl;
- _exec_err.assign(boost::asio::error::connection_aborted, boost::system::system_category());
+ _exec_err.assign(boost::asio::error::connection_aborted, boost::asio::error::get_system_category());
_stop_io_service();
}
//Verify that we are talking to the correct endpoint
if ((_request.header.client_id != _response.header.client_id) && !_exec_err) {
UHD_LOG << "rpc_client confused about who its talking to." << std::endl;
- _exec_err.assign(boost::asio::error::operation_aborted, boost::system::system_category());
+ _exec_err.assign(boost::asio::error::operation_aborted, boost::asio::error::get_system_category());
}
if (!_exec_err) out_args.load(_response.data);
@@ -165,7 +183,7 @@ void rpc_client::_handle_response_hdr(const boost::system::error_code& err, size
} else {
//Unexpected response. Ignore it.
UHD_LOG << "rpc_client received garbage responses." << std::endl;
- _exec_err.assign(boost::asio::error::operation_aborted, boost::system::system_category());
+ _exec_err.assign(boost::asio::error::operation_aborted, boost::asio::error::get_system_category());
_wait_for_next_response_header();
}
@@ -179,7 +197,7 @@ void rpc_client::_handle_response_data(const boost::system::error_code& err, siz
boost::mutex::scoped_lock lock(_mutex);
_exec_err = err;
if (transferred != expected) {
- _exec_err.assign(boost::asio::error::operation_aborted, boost::system::system_category());
+ _exec_err.assign(boost::asio::error::operation_aborted, boost::asio::error::get_system_category());
}
_exec_gate.notify_all();