aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/server_sync.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp/qps/server_sync.cc')
-rw-r--r--test/cpp/qps/server_sync.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index 9954e2c0bf..4ef57bd08b 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -156,12 +156,15 @@ class SynchronousServer final : public grpc::testing::Server {
explicit SynchronousServer(const ServerConfig& config) : Server(config) {
ServerBuilder builder;
- char* server_address = NULL;
-
- gpr_join_host_port(&server_address, "::", port());
- builder.AddListeningPort(server_address,
- Server::CreateServerCredentials(config));
- gpr_free(server_address);
+ auto port_num = port();
+ // Negative port number means inproc server, so no listen port needed
+ if (port_num >= 0) {
+ char* server_address = NULL;
+ gpr_join_host_port(&server_address, "::", port_num);
+ builder.AddListeningPort(server_address,
+ Server::CreateServerCredentials(config));
+ gpr_free(server_address);
+ }
ApplyConfigToBuilder(config, &builder);
@@ -170,6 +173,11 @@ class SynchronousServer final : public grpc::testing::Server {
impl_ = builder.BuildAndStart();
}
+ std::shared_ptr<Channel> InProcessChannel(
+ const ChannelArguments& args) override {
+ return impl_->InProcessChannel(args);
+ }
+
private:
BenchmarkServiceImpl service_;
std::unique_ptr<grpc::Server> impl_;