From fe90ba9d57804ae266f2facd2abc308c84004157 Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 7 Aug 2014 08:26:51 +0200 Subject: [PATCH] minor cleanup --- server_http.hpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/server_http.hpp b/server_http.hpp index 9fba048..0af2e8a 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -18,8 +18,7 @@ namespace SimpleWeb { std::smatch path_match; }; - typedef std::map > > resource_type; + typedef std::map > > resource_type; template class ServerBase { @@ -70,9 +69,9 @@ namespace SimpleWeb { //Created in start() std::vector all_resources; - ServerBase(unsigned short port, size_t num_threads, size_t timeout_request, size_t timeout_send_or_receive) : endpoint(boost::asio::ip::tcp::v4(), port), - acceptor(m_io_service, endpoint), num_threads(num_threads), timeout_request(timeout_request), - timeout_content(timeout_send_or_receive) {} + ServerBase(unsigned short port, size_t num_threads, size_t timeout_request, size_t timeout_send_or_receive) : + endpoint(boost::asio::ip::tcp::v4(), port), acceptor(m_io_service, endpoint), num_threads(num_threads), + timeout_request(timeout_request), timeout_content(timeout_send_or_receive) {} virtual void accept()=0; @@ -231,15 +230,15 @@ namespace SimpleWeb { } std::shared_ptr set_timeout_on_socket(std::shared_ptr socket, size_t seconds) { - std::shared_ptr timeout(new boost::asio::deadline_timer(m_io_service)); - timeout->expires_from_now(boost::posix_time::seconds(seconds)); - timeout->async_wait([socket](const boost::system::error_code& ec){ + std::shared_ptr timer(new boost::asio::deadline_timer(m_io_service)); + timer->expires_from_now(boost::posix_time::seconds(seconds)); + timer->async_wait([socket](const boost::system::error_code& ec){ if(!ec) { socket->shutdown(boost::asio::ip::tcp::socket::shutdown_both); socket->close(); } }); - return timeout; + return timer; } }; }