File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
boost/network/protocol/http/server Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ namespace boost { namespace network { namespace http {
5555 // stop accepting new requests and let all the existing
5656 // handlers finish.
5757 stopping = true ;
58- acceptor.cancel ();
58+ system::error_code ignored;
59+ acceptor.cancel (ignored);
5960 }
6061
6162 void listen () {
@@ -101,10 +102,15 @@ namespace boost { namespace network { namespace http {
101102 tcp::resolver resolver (service_);
102103 tcp::resolver::query query (address_, port_);
103104 tcp::endpoint endpoint = *resolver.resolve (query);
104- acceptor.open (endpoint.protocol ());
105- acceptor.bind (endpoint);
105+
106+ system::error_code error;
107+ acceptor.open (endpoint.protocol (), error);
108+ if (error) return ;
109+ acceptor.bind (endpoint, error);
110+ if (error) return ;
106111 socket_options_base::acceptor_options (acceptor);
107- acceptor.listen ();
112+ acceptor.listen (asio::socket_base::max_connections, error);
113+ if (error) return ;
108114 new_connection.reset (new connection (service_, handler, thread_pool));
109115 acceptor.async_accept (new_connection->socket (),
110116 boost::bind (
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ namespace boost { namespace network { namespace http {
5757
5858 void stop () {
5959 // stop accepting new connections and let all the existing handlers finish.
60- acceptor_.cancel ();
60+ system::error_code ignored;
61+ acceptor_.cancel (ignored);
62+ service_.stop ();
6163 }
6264
6365 void listen () {
You can’t perform that action at this time.
0 commit comments