From e834726d45b03089a18d81cddf26e2298803e4c1 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Fri, 26 Oct 2018 21:14:30 +1100 Subject: [PATCH] api now builds and seems to work --- cmake/compiler.cmake | 3 ++- src/servers/sapphire_api/client_http.hpp | 4 ++-- src/servers/sapphire_api/server_http.hpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index c614329e..06487051 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -28,4 +28,5 @@ else() endif() endif() - +# force standalone asio +add_definitions( -DASIO_STANDALONE ) diff --git a/src/servers/sapphire_api/client_http.hpp b/src/servers/sapphire_api/client_http.hpp index 7f9807fb..7cc8cf53 100644 --- a/src/servers/sapphire_api/client_http.hpp +++ b/src/servers/sapphire_api/client_http.hpp @@ -187,11 +187,11 @@ namespace SimpleWeb { virtual void connect()=0; - std::shared_ptr get_timeout_timer() { + std::shared_ptr< asio::basic_waitable_timer< std::chrono::steady_clock > > get_timeout_timer() { if(config.timeout==0) return nullptr; - auto timer=std::make_shared(io_service); + auto timer=std::make_shared< asio::basic_waitable_timer< std::chrono::steady_clock > >(io_service); timer->expires_from_now( std::chrono::seconds( config.timeout ) ); timer->async_wait([this](const std::error_code& ec) { if(!ec) { diff --git a/src/servers/sapphire_api/server_http.hpp b/src/servers/sapphire_api/server_http.hpp index 6992f773..5b6659fb 100644 --- a/src/servers/sapphire_api/server_http.hpp +++ b/src/servers/sapphire_api/server_http.hpp @@ -220,11 +220,11 @@ namespace SimpleWeb { virtual void accept()=0; - std::shared_ptr get_timeout_timer(const std::shared_ptr &socket, long seconds) { + std::shared_ptr< asio::basic_waitable_timer< std::chrono::steady_clock > > get_timeout_timer(const std::shared_ptr &socket, long seconds) { if(seconds==0) return nullptr; - auto timer=std::make_shared(*io_service); + auto timer = std::make_shared< asio::basic_waitable_timer< std::chrono::steady_clock > >(*io_service); timer->expires_from_now( std::chrono::seconds( seconds ) ); timer->async_wait([socket](const std::error_code& ec){ if(!ec) {