diff options
| author | robot-piglet <[email protected]> | 2023-11-22 20:53:20 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2023-11-23 00:08:57 +0300 |
| commit | bc2dab4e893399e1498885ce2b102ec2e8752cec (patch) | |
| tree | 5dca6eebc5251c67b6fdb269e666e4c22b334110 | |
| parent | 4d2a1daf5a4e6ce0179270e72a5f87da4170cd19 (diff) | |
Intermediate changes
| -rw-r--r-- | yt/yt/core/rpc/grpc/server.cpp | 5 | ||||
| -rw-r--r-- | yt/yt/core/rpc/unittests/lib/common.h | 33 |
2 files changed, 28 insertions, 10 deletions
diff --git a/yt/yt/core/rpc/grpc/server.cpp b/yt/yt/core/rpc/grpc/server.cpp index da0cb100c4a..c845a3f0891 100644 --- a/yt/yt/core/rpc/grpc/server.cpp +++ b/yt/yt/core/rpc/grpc/server.cpp @@ -554,6 +554,11 @@ private: PeerAddressString_ = PeerAddressString_.substr(5); } + if (PeerAddressString_.StartsWith("unix:")) { + PeerAddress_ = NNet::TNetworkAddress::CreateUnixDomainSocketAddress(PeerAddressString_.substr(5)); + return true; + } + // Decode URL-encoded square brackets. CGIUnescape(PeerAddressString_); diff --git a/yt/yt/core/rpc/unittests/lib/common.h b/yt/yt/core/rpc/unittests/lib/common.h index 1e00b584c6a..b3981952ba9 100644 --- a/yt/yt/core/rpc/unittests/lib/common.h +++ b/yt/yt/core/rpc/unittests/lib/common.h @@ -363,7 +363,7 @@ inline TString ServerCert( //////////////////////////////////////////////////////////////////////////////// -template <bool EnableSsl> +template <bool EnableSsl, bool EnableUds> class TRpcOverGrpcImpl { public: @@ -386,7 +386,13 @@ public: channelConfig->Credentials->PemKeyCertPair->CertChain = New<NCrypto::TPemBlobConfig>(); channelConfig->Credentials->PemKeyCertPair->CertChain->Value = ClientCert; } - channelConfig->Address = address; + + if (EnableUds) { + channelConfig->Address = Format("unix:%v", address); + } else { + channelConfig->Address = address; + } + channelConfig->GrpcArguments = std::move(grpcArguments); return NGrpc::CreateGrpcChannel(channelConfig); } @@ -405,9 +411,12 @@ public: serverAddressConfig->Credentials->PemKeyCertPairs[0]->CertChain->Value = ServerCert; } - auto address = Format("localhost:%v", port); + if (EnableUds) { + serverAddressConfig->Address = Format("unix:localhost:%v", port); + } else { + serverAddressConfig->Address = Format("localhost:%v", port); + } - serverAddressConfig->Address = address; auto serverConfig = New<NGrpc::TServerConfig>(); serverConfig->Addresses.push_back(serverAddressConfig); return NGrpc::CreateServer(serverConfig); @@ -450,8 +459,10 @@ using TAllTransports = ::testing::Types< TRpcOverBus<TRpcOverBusImpl<true>>, #endif TRpcOverBus<TRpcOverBusImpl<false>>, - TRpcOverGrpcImpl<false>, - TRpcOverGrpcImpl<true> + TRpcOverGrpcImpl<false, false>, + TRpcOverGrpcImpl<false, true>, + TRpcOverGrpcImpl<true, false>, + TRpcOverGrpcImpl<true, true> >; using TWithoutUds = ::testing::Types< @@ -459,8 +470,8 @@ using TWithoutUds = ::testing::Types< TRpcOverBus<TRpcOverBusImpl<true>>, #endif TRpcOverBus<TRpcOverBusImpl<false>>, - TRpcOverGrpcImpl<false>, - TRpcOverGrpcImpl<true> + TRpcOverGrpcImpl<false, false>, + TRpcOverGrpcImpl<true, false> >; using TWithoutGrpc = ::testing::Types< @@ -472,8 +483,10 @@ using TWithoutGrpc = ::testing::Types< >; using TGrpcOnly = ::testing::Types< - TRpcOverGrpcImpl<false>, - TRpcOverGrpcImpl<true> + TRpcOverGrpcImpl<false, false>, + TRpcOverGrpcImpl<false, true>, + TRpcOverGrpcImpl<true, false>, + TRpcOverGrpcImpl<true, true> >; //////////////////////////////////////////////////////////////////////////////// |
