lidavidm commented on a change in pull request #12465:
URL: https://github.com/apache/arrow/pull/12465#discussion_r823699619
##########
File path: cpp/src/arrow/flight/server.cc
##########
@@ -927,65 +201,18 @@ FlightServerBase::FlightServerBase() { impl_.reset(new
Impl); }
FlightServerBase::~FlightServerBase() {}
Status FlightServerBase::Init(const FlightServerOptions& options) {
- impl_->service_.reset(new FlightServiceImpl(
- options.auth_handler, options.memory_manager, options.middleware, this));
-
- grpc::ServerBuilder builder;
- // Allow uploading messages of any length
- builder.SetMaxReceiveMessageSize(-1);
-
- const Location& location = options.location;
- const std::string scheme = location.scheme();
- if (scheme == kSchemeGrpc || scheme == kSchemeGrpcTcp || scheme ==
kSchemeGrpcTls) {
- std::stringstream address;
- address << arrow::internal::UriEncodeHost(location.uri_->host()) << ':'
- << location.uri_->port_text();
-
- std::shared_ptr<grpc::ServerCredentials> creds;
- if (scheme == kSchemeGrpcTls) {
- grpc::SslServerCredentialsOptions ssl_options;
- for (const auto& pair : options.tls_certificates) {
- ssl_options.pem_key_cert_pairs.push_back({pair.pem_key,
pair.pem_cert});
- }
- if (options.verify_client) {
- ssl_options.client_certificate_request =
- GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY;
- }
- if (!options.root_certificates.empty()) {
- ssl_options.pem_root_certs = options.root_certificates;
- }
- creds = grpc::SslServerCredentials(ssl_options);
- } else {
- creds = grpc::InsecureServerCredentials();
- }
-
- builder.AddListeningPort(address.str(), creds, &impl_->port_);
- } else if (scheme == kSchemeGrpcUnix) {
- std::stringstream address;
- address << "unix:" << location.uri_->path();
- builder.AddListeningPort(address.str(), grpc::InsecureServerCredentials());
- } else {
- return Status::NotImplemented("Scheme is not supported: " + scheme);
- }
-
- builder.RegisterService(impl_->service_.get());
-
- // Disable SO_REUSEPORT - it makes debugging/testing a pain as
- // leftover processes can handle requests on accident
- builder.AddChannelArgument(GRPC_ARG_ALLOW_REUSEPORT, 0);
-
- if (options.builder_hook) {
- options.builder_hook(&builder);
- }
+ flight::transport::grpc::InitializeFlightGrpcServer();
Review comment:
My plan is for other transports to require an explicit initialize call,
but gRPC is implicitly initialized to avoid changing existing code. (That's
because UCX will be its own standalone library and we won't assume that it's
present.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]