X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fserver.cc;h=9a633c861064d776de263743058d7c6c481084e7;hb=c9cadc1e53abb60a485a8a6de3eeecd54892b4d7;hp=1fb3d7d471863a2c3e81ec3c65480c131d2ada47;hpb=970508d98224f0ed6e3b16cd528f49c24d04ff49;p=dcpomatic.git diff --git a/src/lib/server.cc b/src/lib/server.cc index 1fb3d7d47..9a633c861 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -25,9 +25,10 @@ using boost::shared_ptr; -Server::Server (int port) +Server::Server (int port, int timeout) : _terminate (false) , _acceptor (_io_service, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)) + , _timeout (timeout) { } @@ -40,7 +41,7 @@ Server::~Server () } _acceptor.close (); - _io_service.stop (); + stop (); } void @@ -60,7 +61,7 @@ Server::start_accept () } } - shared_ptr socket (new Socket); + shared_ptr socket (new Socket(_timeout)); _acceptor.async_accept (socket->socket (), boost::bind (&Server::handle_accept, this, socket, boost::asio::placeholders::error)); } @@ -74,3 +75,9 @@ Server::handle_accept (shared_ptr socket, boost::system::error_code cons handle (socket); start_accept (); } + +void +Server::stop () +{ + _io_service.stop (); +}