aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/interop/interop_server.cc
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-08-25 08:18:25 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-08-25 08:18:25 -0700
commitf03b112d12d32f42b023a5c49d994438dde0a95e (patch)
tree979d4e64ecf7ed31495d635ea4caa7c037284f72 /test/cpp/interop/interop_server.cc
parent7187ab9866f95181212cdb8b80fcbe0a36b01765 (diff)
parent19ea0cffd7ba3df686ed05671f9ed35b8e9fa830 (diff)
Merge remote-tracking branch 'upstream/master' into cq_verifier_file_line
Diffstat (limited to 'test/cpp/interop/interop_server.cc')
-rw-r--r--test/cpp/interop/interop_server.cc23
1 files changed, 4 insertions, 19 deletions
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc
index ebef0002a3..e5878bb248 100644
--- a/test/cpp/interop/interop_server.cc
+++ b/test/cpp/interop/interop_server.cc
@@ -31,7 +31,6 @@
*
*/
-#include <signal.h>
#include <unistd.h>
#include <fstream>
@@ -78,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";
@@ -311,7 +308,9 @@ class TestServiceImpl : public TestService::Service {
}
};
-void RunServer() {
+void grpc::testing::interop::RunServer(
+ std::shared_ptr<ServerCredentials> creds) {
+ GPR_ASSERT(FLAGS_port != 0);
std::ostringstream server_address;
server_address << "0.0.0.0:" << FLAGS_port;
TestServiceImpl service;
@@ -321,24 +320,10 @@ void RunServer() {
ServerBuilder builder;
builder.RegisterService(&service);
- std::shared_ptr<ServerCredentials> creds =
- grpc::testing::CreateInteropServerCredentials();
builder.AddListeningPort(server_address.str(), creds);
std::unique_ptr<Server> 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);
}
}
-
-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;
-}