Can now use external, or reuse, boost::asio::io_service.

This commit is contained in:
eidheim 2016-10-19 09:53:32 +02:00
commit 3a4b7143cc
2 changed files with 27 additions and 18 deletions

View file

@ -28,9 +28,9 @@ namespace SimpleWeb {
void accept() {
//Create new socket for this connection
//Shared_ptr is used to pass temporary objects to the asynchronous functions
std::shared_ptr<HTTPS> socket(new HTTPS(io_service, context));
std::shared_ptr<HTTPS> socket(new HTTPS(*io_service, context));
acceptor.async_accept((*socket).lowest_layer(), [this, socket](const boost::system::error_code& ec) {
acceptor->async_accept((*socket).lowest_layer(), [this, socket](const boost::system::error_code& ec) {
//Immediately start accepting a new connection
accept();