From 28803d81beebc1283645d79465cdffcf74ef8f62 Mon Sep 17 00:00:00 2001 From: Breeze Chen Date: Tue, 29 Aug 2017 11:19:52 +0800 Subject: [PATCH] Removed dependency of boost::deadline_timer if USE_STANDALONE_ASIO is defined. --- server_http.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server_http.hpp b/server_http.hpp index 28e0b3b..e366818 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -12,6 +12,7 @@ #ifdef USE_STANDALONE_ASIO #include +#include namespace SimpleWeb { using error_code = std::error_code; using errc = std::errc; @@ -19,6 +20,7 @@ namespace SimpleWeb { } // namespace SimpleWeb #else #include +#include namespace SimpleWeb { namespace asio = boost::asio; using error_code = boost::system::error_code; @@ -214,7 +216,7 @@ namespace SimpleWeb { std::unique_ptr socket; // Socket must be unique_ptr since asio::ssl::stream is not movable std::mutex socket_close_mutex; - std::unique_ptr timer; + std::unique_ptr timer; void close() noexcept { error_code ec; @@ -229,8 +231,8 @@ namespace SimpleWeb { return; } - timer = std::unique_ptr(new asio::deadline_timer(socket->get_io_service())); - timer->expires_from_now(boost::posix_time::seconds(seconds)); + timer = std::unique_ptr(new asio::steady_timer(socket->get_io_service())); + timer->expires_from_now(std::chrono::seconds(seconds)); auto self = this->shared_from_this(); timer->async_wait([self](const error_code &ec) { if(!ec)