This commit is contained in:
François 2022-12-05 21:38:47 +08:00 committed by GitHub
commit 6c9ed2c0f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -188,7 +188,13 @@ void server::start_accept(tcp::acceptor &acceptor, serve_mux &mux) {
void server::stop() {
for (auto &acceptor : acceptors_) {
acceptor.close();
std::promise<void> promise;
GET_IO_SERVICE ( acceptor ).dispatch ( [&acceptor, &promise]() {
boost::system::error_code ignored_ec;
acceptor.close ( ignored_ec );
promise.set_value();
} );
promise.get_future().get();
}
io_service_pool_.stop();
}