diff --git a/server_http.hpp b/server_http.hpp index 769b3de..f419ac7 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -134,6 +134,9 @@ namespace SimpleWeb { } } + if(io_service.stopped()) + io_service.reset(); + std::unique_ptr endpoint; if(config.address.size()>0) endpoint=std::unique_ptr(new boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(config.address), config.port)); @@ -146,8 +149,6 @@ namespace SimpleWeb { accept(); - if(io_service.stopped()) - io_service.reset(); //If num_threads>1, start m_io_service.run() in (num_threads-1) threads for thread-pooling threads.clear(); for(size_t c=1;c