transport: Shutdown server on disablebinary

... and do the real "sharded::stop" in the background. On node shutdown
it needs to pick up all dangling background stopping.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2023-07-18 14:54:14 +03:00
parent 4682c7f9a5
commit b42391bfbe
2 changed files with 6 additions and 1 deletions

View File

@@ -185,6 +185,7 @@ future<> controller::stop_server() {
_ops_sem.broken();
_listen_addresses.clear();
co_await do_stop_server();
co_await _bg_stops.close();
}
}
@@ -214,13 +215,15 @@ future<> controller::do_stop_server() {
try {
co_await unsubscribe_server(server);
co_await server.stop();
co_await server.invoke_on_all([] (auto& s) { return s.shutdown(); });
} catch (...) {
if (!ex) {
ex = std::current_exception();
}
}
(void)server.stop().finally([s = std::move(cserver), h = _bg_stops.hold()] {});
if (ex) {
std::rethrow_exception(std::move(ex));
}

View File

@@ -9,6 +9,7 @@
#pragma once
#include <seastar/core/semaphore.hh>
#include <seastar/core/gate.hh>
#include <seastar/core/sharded.hh>
#include <seastar/core/future.hh>
@@ -35,6 +36,7 @@ class controller : public protocol_server {
std::vector<socket_address> _listen_addresses;
std::unique_ptr<sharded<cql_server>> _server;
semaphore _ops_sem; /* protects start/stop operations on _server */
gate _bg_stops;
bool _stopped = false;
sharded<auth::service>& _auth_service;