diff options
author | aozeritsky <aozeritsky@yandex-team.ru> | 2022-02-10 16:46:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:39 +0300 |
commit | 4a6816dea1bcaee46ce29a51a5fd7d3495012858 (patch) | |
tree | d98d6003e190b9e761bd77a83cd98428f9657b35 /library/cpp/grpc | |
parent | 7aa4cf700385ff96999c5cc301171ff157974773 (diff) | |
download | ydb-4a6816dea1bcaee46ce29a51a5fd7d3495012858.tar.gz |
Restoring authorship annotation for <aozeritsky@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/grpc')
-rw-r--r-- | library/cpp/grpc/server/grpc_server.cpp | 36 | ||||
-rw-r--r-- | library/cpp/grpc/server/grpc_server.h | 22 |
2 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/grpc/server/grpc_server.cpp b/library/cpp/grpc/server/grpc_server.cpp index 7437b7a8f5..8863c80832 100644 --- a/library/cpp/grpc/server/grpc_server.cpp +++ b/library/cpp/grpc/server/grpc_server.cpp @@ -56,22 +56,22 @@ void TGRpcServer::Start() { using grpc::ServerBuilder; using grpc::ResourceQuota; ServerBuilder builder; - auto credentials = grpc::InsecureServerCredentials(); - if (Options_.SslData) { + auto credentials = grpc::InsecureServerCredentials(); + if (Options_.SslData) { grpc::SslServerCredentialsOptions::PemKeyCertPair keycert; keycert.cert_chain = std::move(Options_.SslData->Cert); keycert.private_key = std::move(Options_.SslData->Key); grpc::SslServerCredentialsOptions sslOps; sslOps.pem_root_certs = std::move(Options_.SslData->Root); sslOps.pem_key_cert_pairs.push_back(keycert); - credentials = grpc::SslServerCredentials(sslOps); - } - if (Options_.ExternalListener) { - Options_.ExternalListener->Init(builder.experimental().AddExternalConnectionAcceptor( - ServerBuilder::experimental_type::ExternalConnectionType::FROM_FD, - credentials - )); - } else { + credentials = grpc::SslServerCredentials(sslOps); + } + if (Options_.ExternalListener) { + Options_.ExternalListener->Init(builder.experimental().AddExternalConnectionAcceptor( + ServerBuilder::experimental_type::ExternalConnectionType::FROM_FD, + credentials + )); + } else { builder.AddListeningPort(server_address, credentials); } builder.SetMaxReceiveMessageSize(Options_.MaxMessageSize); @@ -171,10 +171,10 @@ void TGRpcServer::Start() { })); } } - - if (Options_.ExternalListener) { - Options_.ExternalListener->Start(); - } + + if (Options_.ExternalListener) { + Options_.ExternalListener->Start(); + } } void TGRpcServer::Stop() { @@ -223,10 +223,10 @@ void TGRpcServer::Stop() { } Ts.clear(); - - if (Options_.ExternalListener) { - Options_.ExternalListener->Stop(); - } + + if (Options_.ExternalListener) { + Options_.ExternalListener->Stop(); + } } ui16 TGRpcServer::GetPort() const { diff --git a/library/cpp/grpc/server/grpc_server.h b/library/cpp/grpc/server/grpc_server.h index d6814a90a0..9cb55e3154 100644 --- a/library/cpp/grpc/server/grpc_server.h +++ b/library/cpp/grpc/server/grpc_server.h @@ -27,15 +27,15 @@ struct TSslData { TString Root; }; -struct IExternalListener - : public TThrRefBase -{ - using TPtr = TIntrusivePtr<IExternalListener>; - virtual void Init(std::unique_ptr<grpc::experimental::ExternalConnectionAcceptor> acceptor) = 0; - virtual void Start() = 0; - virtual void Stop() = 0; -}; - +struct IExternalListener + : public TThrRefBase +{ + using TPtr = TIntrusivePtr<IExternalListener>; + virtual void Init(std::unique_ptr<grpc::experimental::ExternalConnectionAcceptor> acceptor) = 0; + virtual void Start() = 0; + virtual void Stop() = 0; +}; + //! Server's options. struct TServerOptions { #define DECLARE_FIELD(name, type, default) \ @@ -93,8 +93,8 @@ struct TServerOptions { //! Custom configurator for ServerBuilder. DECLARE_FIELD(ServerBuilderMutator, std::function<void(grpc::ServerBuilder&)>, [](grpc::ServerBuilder&){}); - DECLARE_FIELD(ExternalListener, IExternalListener::TPtr, nullptr); - + DECLARE_FIELD(ExternalListener, IExternalListener::TPtr, nullptr); + //! Logger which will be used to write logs about requests handling (iff appropriate log level is enabled). DECLARE_FIELD(Logger, TLoggerPtr, nullptr); |