File tree 2 files changed +13
-5
lines changed
boost/network/protocol/http/server
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 {
55
55
// stop accepting new requests and let all the existing
56
56
// handlers finish.
57
57
stopping = true ;
58
- acceptor.cancel ();
58
+ system ::error_code ignored;
59
+ acceptor.cancel (ignored);
59
60
}
60
61
61
62
void listen () {
@@ -101,10 +102,15 @@ namespace boost { namespace network { namespace http {
101
102
tcp::resolver resolver (service_);
102
103
tcp::resolver::query query (address_, port_);
103
104
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 ;
106
111
socket_options_base::acceptor_options (acceptor);
107
- acceptor.listen ();
112
+ acceptor.listen (asio::socket_base::max_connections, error);
113
+ if (error) return ;
108
114
new_connection.reset (new connection (service_, handler, thread_pool));
109
115
acceptor.async_accept (new_connection->socket (),
110
116
boost::bind (
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ namespace boost { namespace network { namespace http {
57
57
58
58
void stop () {
59
59
// 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 ();
61
63
}
62
64
63
65
void listen () {
You can’t perform that action at this time.
0 commit comments