thrift: return address in listen_addresses() only after server is ready

listen_addresses() checks if _server variable is empty and after this
patch we assign (move) the value only after server is ready.

This is used for readiness API: /storage_service/rpc_server and the fix
prevents from returning 'true' prematurely. Some improvement for readiness
was added in a51529dd15 but thrift implementation
wasn't fully done.

Fixes #12376
This commit is contained in:
Marcin Maliszkiewicz
2023-03-27 13:20:53 +02:00
parent a38701b9d4
commit 339a8fe64d

View File

@@ -58,8 +58,7 @@ future<> thrift_controller::do_start_server() {
return make_ready_future<>();
}
return seastar::async([this] {
_server = std::make_unique<distributed<thrift_server>>();
auto tserver = &*_server;
auto tserver = std::make_unique<distributed<thrift_server>>();
_addr.reset();
auto& cfg = _db.local().get_config();
@@ -81,6 +80,7 @@ future<> thrift_controller::do_start_server() {
//});
tserver->invoke_on_all(&thrift_server::listen, socket_address{ip, port}, keepalive).get();
clogger.info("Thrift server listening on {}:{} ...", ip, port);
_server = std::move(tserver);
});
}