http_server.hpp
Go to the documentation of this file.
00001 #ifndef CPP_WEB_SERVER_HTTP_SERVER_HPP
00002 #define CPP_WEB_SERVER_HTTP_SERVER_HPP
00003 
00004 #include <boost/asio.hpp>
00005 #include <string>
00006 #include <vector>
00007 #include <boost/noncopyable.hpp>
00008 #include <boost/function.hpp>
00009 #include <boost/shared_ptr.hpp>
00010 #include <boost/thread/thread.hpp>
00011 
00012 #include "async_web_server_cpp/http_request_handler.hpp"
00013 #include "async_web_server_cpp/http_connection.hpp"
00014 
00015 namespace async_web_server_cpp
00016 {
00017 
00024 class HttpServer : private boost::noncopyable
00025 {
00026 public:
00027   HttpServer(const std::string &address, const std::string &port,
00028              HttpServerRequestHandler request_handler, std::size_t thread_pool_size);
00029   ~HttpServer();
00030 
00031   void run();
00032 
00033   void stop();
00034 
00035 private:
00036   void start_accept();
00037 
00038   void handle_accept(const boost::system::error_code &e);
00039 
00040   boost::asio::io_service io_service_;
00041   boost::asio::ip::tcp::acceptor acceptor_;
00042   std::size_t thread_pool_size_;
00043   std::vector<boost::shared_ptr<boost::thread> > threads_;
00044   boost::shared_ptr<HttpConnection> new_connection_;
00045   HttpServerRequestHandler request_handler_;
00046 };
00047 
00048 }
00049 
00050 #endif


async_web_server_cpp
Author(s): Mitchell Wills
autogenerated on Sat Jun 8 2019 18:56:50