diff options
author | eidheim <eidheim@gmail.com> | 2020-08-26 12:18:47 +0300 |
---|---|---|
committer | eidheim <eidheim@gmail.com> | 2020-08-26 12:18:47 +0300 |
commit | 84ebe12828cfe2508dce0c523fab3c867741e602 (patch) | |
tree | cd37cf9a7177cd830c4b4024fbce24cd5a67ac11 | |
parent | d1d6b015172731902c88bcd2c7fe064c55605844 (diff) |
Fixes #151: compilation issue with standalone asio 1.18
-rw-r--r-- | asio_compatibility.hpp | 6 | ||||
-rw-r--r-- | client_ws.hpp | 2 | ||||
-rw-r--r-- | server_ws.hpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/asio_compatibility.hpp b/asio_compatibility.hpp index a9abd7c..3d2df07 100644 --- a/asio_compatibility.hpp +++ b/asio_compatibility.hpp @@ -42,9 +42,9 @@ namespace SimpleWeb { inline asio::ip::address make_address(const std::string &str) noexcept { return asio::ip::make_address(str); } - template <typename socket_type> - asio::executor get_socket_executor(socket_type &socket) { - return socket.get_executor(); + template <typename socket_type, typename duration_type> + asio::steady_timer make_steady_timer(socket_type &socket, std::chrono::duration<duration_type> duration) { + return asio::steady_timer(socket.get_executor(), duration); } template <typename handler_type> void async_resolve(asio::ip::tcp::resolver &resolver, const std::pair<std::string, std::string> &host_port, handler_type &&handler) { diff --git a/client_ws.hpp b/client_ws.hpp index b5ce2d7..3448c3a 100644 --- a/client_ws.hpp +++ b/client_ws.hpp @@ -106,7 +106,7 @@ namespace SimpleWeb { return; } - timer = std::unique_ptr<asio::steady_timer>(new asio::steady_timer(get_socket_executor(*socket), std::chrono::seconds(seconds))); + timer = std::unique_ptr<asio::steady_timer>(new asio::steady_timer(make_steady_timer(*socket, std::chrono::seconds(seconds)))); std::weak_ptr<Connection> connection_weak(this->shared_from_this()); // To avoid keeping Connection instance alive longer than needed timer->async_wait([connection_weak, use_timeout_idle](const error_code &ec) { if(!ec) { diff --git a/server_ws.hpp b/server_ws.hpp index 158813d..90379ae 100644 --- a/server_ws.hpp +++ b/server_ws.hpp @@ -160,7 +160,7 @@ namespace SimpleWeb { return; } - timer = std::unique_ptr<asio::steady_timer>(new asio::steady_timer(get_socket_executor(*socket), std::chrono::seconds(seconds))); + timer = std::unique_ptr<asio::steady_timer>(new asio::steady_timer(make_steady_timer(*socket, std::chrono::seconds(seconds)))); std::weak_ptr<Connection> connection_weak(this->shared_from_this()); // To avoid keeping Connection instance alive longer than needed timer->async_wait([connection_weak](const error_code &ec) { if(!ec) { |