From 6a7ffd27634874f5302ba9bbf334d7b22d497a75 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 24 Sep 2018 09:58:17 -0600 Subject: [PATCH 1/3] Update to build against boost 1.68 boost::asio::io_service became boost::asio::io_context boost::posix_time::milliseconds requires long --- include/opc/ua/server/addons/asio_addon.h | 4 ++-- include/opc/ua/server/opc_tcp_async.h | 4 ++-- include/opc/ua/server/subscription_service.h | 4 ++-- src/server/asio_addon.cpp | 6 +++--- src/server/internal_subscription.cpp | 4 ++-- src/server/internal_subscription.h | 2 +- src/server/opc_tcp_async.cpp | 10 +++++----- src/server/server_object.cpp | 2 +- src/server/server_object.h | 4 ++-- src/server/subscription_service_internal.cpp | 6 +++--- src/server/subscription_service_internal.h | 6 +++--- src/server/timer.h | 2 +- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/opc/ua/server/addons/asio_addon.h b/include/opc/ua/server/addons/asio_addon.h index 8fed93e3..de3326a2 100644 --- a/include/opc/ua/server/addons/asio_addon.h +++ b/include/opc/ua/server/addons/asio_addon.h @@ -28,7 +28,7 @@ namespace boost namespace asio { -class io_service; +class io_context; } } @@ -47,7 +47,7 @@ class AsioAddon : public Common::Addon DEFINE_CLASS_POINTERS(AsioAddon) public: - virtual boost::asio::io_service & GetIoService() = 0; + virtual boost::asio::io_context & GetIoService() = 0; }; diff --git a/include/opc/ua/server/opc_tcp_async.h b/include/opc/ua/server/opc_tcp_async.h index e68f6cc2..1ed06969 100644 --- a/include/opc/ua/server/opc_tcp_async.h +++ b/include/opc/ua/server/opc_tcp_async.h @@ -26,7 +26,7 @@ namespace boost { namespace asio { -class io_service; +class io_context; } } @@ -53,7 +53,7 @@ class AsyncOpcTcp : private Common::Interface virtual void Shutdown() = 0; }; -AsyncOpcTcp::UniquePtr CreateAsyncOpcTcp(const AsyncOpcTcp::Parameters & params, Services::SharedPtr server, boost::asio::io_service & io, const Common::Logger::SharedPtr & logger); +AsyncOpcTcp::UniquePtr CreateAsyncOpcTcp(const AsyncOpcTcp::Parameters & params, Services::SharedPtr server, boost::asio::io_context & io, const Common::Logger::SharedPtr & logger); } } diff --git a/include/opc/ua/server/subscription_service.h b/include/opc/ua/server/subscription_service.h index 5ff0e088..a0381bb3 100644 --- a/include/opc/ua/server/subscription_service.h +++ b/include/opc/ua/server/subscription_service.h @@ -19,7 +19,7 @@ namespace boost { namespace asio { -class io_service; +class io_context; } } @@ -36,7 +36,7 @@ class SubscriptionService : public SubscriptionServices virtual void TriggerEvent(NodeId node, Event event) = 0; }; - SubscriptionService::UniquePtr CreateSubscriptionService(std::shared_ptr addressspace, boost::asio::io_service & io, const Common::Logger::SharedPtr & logger); + SubscriptionService::UniquePtr CreateSubscriptionService(std::shared_ptr addressspace, boost::asio::io_context & io, const Common::Logger::SharedPtr & logger); } // namespace UaServer } // nmespace OpcUa diff --git a/src/server/asio_addon.cpp b/src/server/asio_addon.cpp index 795a6b2c..c098a9dc 100644 --- a/src/server/asio_addon.cpp +++ b/src/server/asio_addon.cpp @@ -61,7 +61,7 @@ class AsioAddonImpl : public OpcUa::Server::AsioAddon }); } - virtual boost::asio::io_service & GetIoService() override + virtual boost::asio::io_context & GetIoService() override { return IoService; } @@ -83,8 +83,8 @@ class AsioAddonImpl : public OpcUa::Server::AsioAddon } private: - boost::asio::io_service IoService; - boost::asio::io_service::work Work; + boost::asio::io_context IoService; + boost::asio::io_context::work Work; std::vector Threads; }; } diff --git a/src/server/internal_subscription.cpp b/src/server/internal_subscription.cpp index edf4715b..54c1fcf8 100644 --- a/src/server/internal_subscription.cpp +++ b/src/server/internal_subscription.cpp @@ -14,7 +14,7 @@ InternalSubscription::InternalSubscription(SubscriptionServiceInternal & service , CurrentSession(SessionAuthenticationToken) , Callback(callback) , io(service.GetIOService()) - , Timer(io, boost::posix_time::milliseconds(data.RevisedPublishingInterval)) + , Timer(io, boost::posix_time::milliseconds(long(data.RevisedPublishingInterval))) , LifeTimeCount(data.RevisedLifetimeCount) , Logger(logger) { @@ -105,7 +105,7 @@ void InternalSubscription::PublishResults(const boost::system::error_code & erro } TimerStopped = false; - Timer.expires_at(Timer.expires_at() + boost::posix_time::milliseconds(Data.RevisedPublishingInterval)); + Timer.expires_at(Timer.expires_at() + boost::posix_time::milliseconds(long(Data.RevisedPublishingInterval))); std::shared_ptr self = shared_from_this(); Timer.async_wait([self](const boost::system::error_code & error) { self->PublishResults(error); }); } diff --git a/src/server/internal_subscription.h b/src/server/internal_subscription.h index d42aa65b..20553bc8 100644 --- a/src/server/internal_subscription.h +++ b/src/server/internal_subscription.h @@ -104,7 +104,7 @@ class InternalSubscription : public std::enable_shared_from_this NotAcknowledgedResults; //result that have not be acknowledeged and may have to be resent std::list TriggeredDataChangeEvents; std::list TriggeredEvents; - boost::asio::io_service & io; + boost::asio::io_context & io; boost::asio::deadline_timer Timer; bool TimerStopped = false; uint32_t LifeTimeCount; diff --git a/src/server/opc_tcp_async.cpp b/src/server/opc_tcp_async.cpp index dc700c2b..a413ab45 100644 --- a/src/server/opc_tcp_async.cpp +++ b/src/server/opc_tcp_async.cpp @@ -55,7 +55,7 @@ class OpcTcpServer : public OpcUa::Server::AsyncOpcTcp DEFINE_CLASS_POINTERS(OpcTcpServer) public: - OpcTcpServer(const AsyncOpcTcp::Parameters & params, Services::SharedPtr server, boost::asio::io_service & ioService, const Common::Logger::SharedPtr & logger); + OpcTcpServer(const AsyncOpcTcp::Parameters & params, Services::SharedPtr server, boost::asio::io_context & ioService, const Common::Logger::SharedPtr & logger); virtual void Listen() override; virtual void Shutdown() override; @@ -106,7 +106,7 @@ class OpcTcpConnection : public std::enable_shared_from_this, */ typedef std::promise Promise; Promise promise; - Socket.get_io_service().post(bind(&Promise::set_value, &promise)); + Socket.get_io_context().post(bind(&Promise::set_value, &promise)); promise.get_future().wait(); } @@ -293,7 +293,7 @@ void OpcTcpConnection::Send(const char * message, std::size_t size) }); } -OpcTcpServer::OpcTcpServer(const AsyncOpcTcp::Parameters & params, Services::SharedPtr server, boost::asio::io_service & ioService, const Common::Logger::SharedPtr & logger) +OpcTcpServer::OpcTcpServer(const AsyncOpcTcp::Parameters & params, Services::SharedPtr server, boost::asio::io_context & ioService, const Common::Logger::SharedPtr & logger) : Params(params) , Server(server) , Logger(logger) @@ -372,7 +372,7 @@ void OpcTcpServer::Shutdown() */ typedef std::promise Promise; Promise promise; - acceptor.get_io_service().post(bind(&Promise::set_value, &promise)); + acceptor.get_io_context().post(bind(&Promise::set_value, &promise)); promise.get_future().wait(); } @@ -421,7 +421,7 @@ void OpcTcpServer::RemoveClient(OpcTcpConnection::SharedPtr client) } // namespace -OpcUa::Server::AsyncOpcTcp::UniquePtr OpcUa::Server::CreateAsyncOpcTcp(const OpcUa::Server::AsyncOpcTcp::Parameters & params, Services::SharedPtr server, boost::asio::io_service & io, const Common::Logger::SharedPtr & logger) +OpcUa::Server::AsyncOpcTcp::UniquePtr OpcUa::Server::CreateAsyncOpcTcp(const OpcUa::Server::AsyncOpcTcp::Parameters & params, Services::SharedPtr server, boost::asio::io_context & io, const Common::Logger::SharedPtr & logger) { return AsyncOpcTcp::UniquePtr(new OpcTcpServer(params, server, io, logger)); } diff --git a/src/server/server_object.cpp b/src/server/server_object.cpp index f35b168b..96df090a 100644 --- a/src/server/server_object.cpp +++ b/src/server/server_object.cpp @@ -55,7 +55,7 @@ namespace OpcUa namespace Server { -ServerObject::ServerObject(Services::SharedPtr services, boost::asio::io_service & io, bool debug) +ServerObject::ServerObject(Services::SharedPtr services, boost::asio::io_context & io, bool debug) : Server(services) // , Io(io) , Debug(debug) diff --git a/src/server/server_object.h b/src/server/server_object.h index 99519eda..a7f54c95 100644 --- a/src/server/server_object.h +++ b/src/server/server_object.h @@ -28,7 +28,7 @@ namespace boost { namespace asio { -class io_service; +class io_context; } } @@ -43,7 +43,7 @@ class ServerObject DEFINE_CLASS_POINTERS(ServerObject) public: - ServerObject(Services::SharedPtr services, boost::asio::io_service & io, bool debug); + ServerObject(Services::SharedPtr services, boost::asio::io_context & io, bool debug); ~ServerObject(); private: diff --git a/src/server/subscription_service_internal.cpp b/src/server/subscription_service_internal.cpp index b4d0d126..9c664b92 100644 --- a/src/server/subscription_service_internal.cpp +++ b/src/server/subscription_service_internal.cpp @@ -33,7 +33,7 @@ namespace OpcUa namespace Internal { -SubscriptionServiceInternal::SubscriptionServiceInternal(Server::AddressSpace::SharedPtr addressspace, boost::asio::io_service & ioService, const Common::Logger::SharedPtr & logger) +SubscriptionServiceInternal::SubscriptionServiceInternal(Server::AddressSpace::SharedPtr addressspace, boost::asio::io_context & ioService, const Common::Logger::SharedPtr & logger) : io(ioService) , AddressSpace(addressspace) , Logger(logger) @@ -49,7 +49,7 @@ Server::AddressSpace & SubscriptionServiceInternal::GetAddressSpace() return *AddressSpace; } -boost::asio::io_service & SubscriptionServiceInternal::GetIOService() +boost::asio::io_context & SubscriptionServiceInternal::GetIOService() { return io; } @@ -288,7 +288,7 @@ void SubscriptionServiceInternal::TriggerEvent(NodeId node, Event event) namespace Server { -SubscriptionService::UniquePtr CreateSubscriptionService(std::shared_ptr addressspace, boost::asio::io_service & io, const Common::Logger::SharedPtr & logger) +SubscriptionService::UniquePtr CreateSubscriptionService(std::shared_ptr addressspace, boost::asio::io_context & io, const Common::Logger::SharedPtr & logger) { return SubscriptionService::UniquePtr(new Internal::SubscriptionServiceInternal(addressspace, io, logger)); } diff --git a/src/server/subscription_service_internal.h b/src/server/subscription_service_internal.h index 6b16e1d0..60b05bc9 100644 --- a/src/server/subscription_service_internal.h +++ b/src/server/subscription_service_internal.h @@ -44,7 +44,7 @@ typedef std::map > Subscriptions class SubscriptionServiceInternal : public Server::SubscriptionService { public: - SubscriptionServiceInternal(Server::AddressSpace::SharedPtr addressspace, boost::asio::io_service & io, const Common::Logger::SharedPtr & logger); + SubscriptionServiceInternal(Server::AddressSpace::SharedPtr addressspace, boost::asio::io_context & io, const Common::Logger::SharedPtr & logger); ~SubscriptionServiceInternal(); @@ -57,13 +57,13 @@ class SubscriptionServiceInternal : public Server::SubscriptionService virtual RepublishResponse Republish(const RepublishParameters & request); void DeleteAllSubscriptions(); - boost::asio::io_service & GetIOService(); + boost::asio::io_context & GetIOService(); bool PopPublishRequest(NodeId node); void TriggerEvent(NodeId node, Event event); Server::AddressSpace & GetAddressSpace(); private: - boost::asio::io_service & io; + boost::asio::io_context & io; Server::AddressSpace::SharedPtr AddressSpace; Common::Logger::SharedPtr Logger; mutable boost::shared_mutex DbMutex; diff --git a/src/server/timer.h b/src/server/timer.h index 2958666f..64b48e75 100644 --- a/src/server/timer.h +++ b/src/server/timer.h @@ -30,7 +30,7 @@ namespace OpcUa class PeriodicTimer { public: - PeriodicTimer(boost::asio::io_service & io) + PeriodicTimer(boost::asio::io_context & io) : Timer(io) , IsCanceled(true) , Stopped(true) From dd556cb2fa8a73125527e464dcab0b2a4b4d0418 Mon Sep 17 00:00:00 2001 From: Gary Morton Date: Fri, 28 Sep 2018 12:31:57 -0600 Subject: [PATCH 2/3] update travis for boost 1.68 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b6855b5a..9ace7594 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ language: cpp compiler: gcc install: - - sudo apt-get install libboost1.54-all-dev -qq - - sudo apt-get install libboost-python1.54-dev -qq + - sudo apt-get install libboost1.68-all-dev -qq + - sudo apt-get install libboost-python1.68-dev -qq - sudo apt-get install libcppunit-dev #script: autoreconf -f -i && ./configure --disable-python-bindings && make && make check From 93b760781b6902a33c580ca05b77f182d08d455d Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 28 Sep 2018 12:52:47 -0600 Subject: [PATCH 3/3] try boost 1.67 with travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9ace7594..7fe65529 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ language: cpp compiler: gcc install: - - sudo apt-get install libboost1.68-all-dev -qq - - sudo apt-get install libboost-python1.68-dev -qq + - sudo apt-get install libboost1.67-all-dev -qq + - sudo apt-get install libboost-python1.67-dev -qq - sudo apt-get install libcppunit-dev #script: autoreconf -f -i && ./configure --disable-python-bindings && make && make check