Minor cleanup of exception_handler code
This commit is contained in:
parent
eafca19cb3
commit
87508d1ae2
1 changed files with 4 additions and 7 deletions
|
|
@ -84,11 +84,6 @@ namespace SimpleWeb {
|
||||||
Request(): content(streambuf) {}
|
Request(): content(streambuf) {}
|
||||||
|
|
||||||
boost::asio::streambuf 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 {
|
class Config {
|
||||||
|
|
@ -112,6 +107,8 @@ namespace SimpleWeb {
|
||||||
|
|
||||||
std::unordered_map<std::string,
|
std::unordered_map<std::string,
|
||||||
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>, std::shared_ptr<typename ServerBase<socket_type>::Request>)> > default_resource;
|
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>, std::shared_ptr<typename ServerBase<socket_type>::Request>)> > default_resource;
|
||||||
|
|
||||||
|
std::function<void(const std::exception&)> exception_handler;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::pair<std::string, std::vector<std::pair<boost::regex,
|
std::vector<std::pair<std::string, std::vector<std::pair<boost::regex,
|
||||||
|
|
@ -183,7 +180,6 @@ namespace SimpleWeb {
|
||||||
callback(ec);
|
callback(ec);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
std::function<void(const std::exception&)> exception_handler;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
boost::asio::io_service io_service;
|
boost::asio::io_service io_service;
|
||||||
|
|
@ -217,7 +213,8 @@ namespace SimpleWeb {
|
||||||
//shared_ptr is used to pass temporary objects to the asynchronous functions
|
//shared_ptr is used to pass temporary objects to the asynchronous functions
|
||||||
std::shared_ptr<Request> request(new Request());
|
std::shared_ptr<Request> request(new Request());
|
||||||
try {
|
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) {
|
catch(const std::exception &e) {
|
||||||
if(exception_handler)
|
if(exception_handler)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue