From 6570b83c9cf40e749a8b57c33df123993b0fb680 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 18 Jul 2016 23:29:50 +0200 Subject: Splitting interop_server.cc --- test/cpp/interop/interop_server.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'test/cpp/interop/interop_server.cc') diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc index ebef0002a3..384d8da720 100644 --- a/test/cpp/interop/interop_server.cc +++ b/test/cpp/interop/interop_server.cc @@ -31,7 +31,6 @@ * */ -#include #include #include @@ -311,7 +310,9 @@ class TestServiceImpl : public TestService::Service { } }; -void RunServer() { +void grpc::testing::interop::RunServer( + std::shared_ptr creds) { + GPR_ASSERT(FLAGS_port != 0); std::ostringstream server_address; server_address << "0.0.0.0:" << FLAGS_port; TestServiceImpl service; @@ -321,8 +322,6 @@ void RunServer() { ServerBuilder builder; builder.RegisterService(&service); - std::shared_ptr creds = - grpc::testing::CreateInteropServerCredentials(); builder.AddListeningPort(server_address.str(), creds); std::unique_ptr server(builder.BuildAndStart()); gpr_log(GPR_INFO, "Server listening on %s", server_address.str().c_str()); @@ -330,15 +329,3 @@ void RunServer() { sleep(5); } } - -static void sigint_handler(int x) { got_sigint = true; } - -int main(int argc, char** argv) { - grpc::testing::InitTest(&argc, &argv, true); - signal(SIGINT, sigint_handler); - - GPR_ASSERT(FLAGS_port != 0); - RunServer(); - - return 0; -} -- cgit v1.2.3 From 96b7b521902a7e1c8b50abdb04752a84451f9a1c Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Mon, 1 Aug 2016 09:33:38 -0700 Subject: Fix exit condition --- test/cpp/interop/interop_server.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'test/cpp/interop/interop_server.cc') diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc index 384d8da720..e5878bb248 100644 --- a/test/cpp/interop/interop_server.cc +++ b/test/cpp/interop/interop_server.cc @@ -77,8 +77,6 @@ using grpc::testing::StreamingOutputCallResponse; using grpc::testing::TestService; using grpc::Status; -static bool got_sigint = false; - const char kEchoInitialMetadataKey[] = "x-grpc-test-echo-initial"; const char kEchoTrailingBinMetadataKey[] = "x-grpc-test-echo-trailing-bin"; const char kEchoUserAgentKey[] = "x-grpc-test-echo-useragent"; @@ -325,7 +323,7 @@ void grpc::testing::interop::RunServer( builder.AddListeningPort(server_address.str(), creds); std::unique_ptr server(builder.BuildAndStart()); gpr_log(GPR_INFO, "Server listening on %s", server_address.str().c_str()); - while (!got_sigint) { + while (!g_got_sigint) { sleep(5); } } -- cgit v1.2.3