From 87508d1ae24b4317e3b5282579158775ef8dffd6 Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 7 Sep 2016 09:01:01 +0200 Subject: [PATCH] Minor cleanup of exception_handler code --- server_http.hpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/server_http.hpp b/server_http.hpp index ea75582..1c3ba05 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -84,11 +84,6 @@ namespace SimpleWeb { Request(): content(streambuf) {} boost::asio::streambuf streambuf; - - void read_remote_endpoint_data(socket_type& socket) { - remote_endpoint_address=socket.lowest_layer().remote_endpoint().address().to_string(); - remote_endpoint_port=socket.lowest_layer().remote_endpoint().port(); - } }; class Config { @@ -112,6 +107,8 @@ namespace SimpleWeb { std::unordered_map::Response>, std::shared_ptr::Request>)> > default_resource; + + std::function exception_handler; private: std::vector exception_handler; protected: boost::asio::io_service io_service; @@ -217,7 +213,8 @@ namespace SimpleWeb { //shared_ptr is used to pass temporary objects to the asynchronous functions std::shared_ptr request(new Request()); try { - request->read_remote_endpoint_data(*socket); + request->remote_endpoint_address=socket->lowest_layer().remote_endpoint().address().to_string(); + request->remote_endpoint_port=socket->lowest_layer().remote_endpoint().port(); } catch(const std::exception &e) { if(exception_handler)