10 std::size_t thread_pool_size)
11 : acceptor_(io_service_), thread_pool_size_(thread_pool_size),
12 request_handler_(request_handler)
15 boost::asio::ip::tcp::resolver resolver(
io_service_);
16 boost::asio::ip::tcp::resolver::query query(
17 address, port, boost::asio::ip::resolver_query_base::flags());
18 boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
20 acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(
true));
35 boost::shared_ptr<boost::thread> thread(
new boost::thread(
36 boost::bind(&boost::asio::io_service::run, &
io_service_)));
46 boost::asio::placeholders::error));
67 for (std::size_t i = 0; i <
threads_.size(); ++i)
std::size_t thread_pool_size_
boost::shared_ptr< HttpConnection > new_connection_
boost::asio::io_service io_service_
boost::asio::ip::tcp::acceptor acceptor_
void handle_accept(const boost::system::error_code &e)
boost::function< bool(const HttpRequest &, boost::shared_ptr< HttpConnection >, const char *begin, const char *end)> HttpServerRequestHandler
std::vector< boost::shared_ptr< boost::thread > > threads_
HttpServer(const std::string &address, const std::string &port, HttpServerRequestHandler request_handler, std::size_t thread_pool_size)
HttpServerRequestHandler request_handler_