@@ -202,6 +202,9 @@ auto ligo::detail::stop_accepting_server(std::shared_ptr<S> state) -> void {
|
||||
return;
|
||||
}
|
||||
state->sessions->cancel_all();
|
||||
if constexpr (requires { state->tls_sessions; }) {
|
||||
state->tls_sessions->cancel_all();
|
||||
}
|
||||
auto server_executor = state->strand;
|
||||
boost::asio::post(server_executor, [state = std::move(state)] {
|
||||
auto ignored = boost::system::error_code{};
|
||||
@@ -216,6 +219,9 @@ auto ligo::detail::stop_accepting_server_now(std::shared_ptr<S> const &state) ->
|
||||
return;
|
||||
}
|
||||
state->sessions->cancel_all();
|
||||
if constexpr (requires { state->tls_sessions; }) {
|
||||
state->tls_sessions->cancel_all();
|
||||
}
|
||||
auto ignored = boost::system::error_code{};
|
||||
state->acceptor->close(ignored);
|
||||
}
|
||||
@@ -232,6 +238,9 @@ auto ligo::detail::async_stop_accepting_server(std::shared_ptr<S> state, std::ch
|
||||
should_stop = !state->stopped.exchange(true);
|
||||
if (should_stop) {
|
||||
state->sessions->cancel_all();
|
||||
if constexpr (requires { state->tls_sessions; }) {
|
||||
state->tls_sessions->cancel_all();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (should_stop) {
|
||||
@@ -239,5 +248,12 @@ auto ligo::detail::async_stop_accepting_server(std::shared_ptr<S> state, std::ch
|
||||
auto ignored = boost::system::error_code{};
|
||||
state->acceptor->close(ignored);
|
||||
}
|
||||
co_return co_await state->sessions->wait_empty(timeout);
|
||||
auto drained = co_await state->sessions->wait_empty(timeout);
|
||||
if (!drained) {
|
||||
co_return drained;
|
||||
}
|
||||
if constexpr (requires { state->tls_sessions; }) {
|
||||
co_return co_await state->tls_sessions->wait_empty(timeout);
|
||||
}
|
||||
co_return drained;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user